JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 17380
  • Score
    100M100P100Q140702F
  • License MIT

Collection of basic layout algorithms for graphology.

Package Exports

  • graphology-layout

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (graphology-layout) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Build Status

Graphology Layout

Collection of basic layout algorithms to be used with graphology.

Installation

npm install graphology-layout

Usage

#.circlePack

Arranges the nodes as a bubble chart, according to specified attributes.

Example

import {circlepack} from 'graphology-layout';
// Alternatively, to load only the relevant code:
import circlepack from 'graphology-layout/circlepack';

const positions = circlepack(Graph);

// With options
const positions = circlepack(Graph, {hierarchyAttributes: ['degree', 'community'], rng: customRngFunction});

// To directly assign the positions to the nodes:
circlepack.assign(Graph);

Arguments

  • graph Graph: target graph.
  • options ?object: options:
    • attributes ?object: attributes to map:
      • x ?string [x]: name of the x position.
      • y ?string [y]: name of the y position.
    • center ?number [0]: center of the layout.
    • hierarchyAttributes ?list [[]]: attributes used to group nodes.
    • rng ?function [Math.random]: custom RNG function to use.
    • scale ?number [1]: scale of the layout.

#.circular

Arranges the node in a circle.

Example

import {circular} from 'graphology-layout';
// Alternatively, to load only the relevant code:
import circular from 'graphology-layout/circular';

const positions = circular(Graph);

// With options:
const positions = circular(Graph, {scale: 100});

// To directly assign the positions to the nodes:
circular.assign(Graph);

Arguments

  • graph Graph: target graph.
  • options ?object: options:
    • attributes ?object: attributes to map:
      • x ?string [x]: name of the x position.
      • y ?string [y]: name of the y position.
    • center ?number [0.5]: center of the layout.
    • scale ?number [1]: scale of the layout.

#.random

Random layout positioning every node by choosing each coordinates uniformly at random on the interval [0, 1).

Example

import {random} from 'graphology-layout';
// Alternatively, to load only the relevant code:
import random from 'graphology-layout/random';

const positions = random(Graph);

// With options:
const positions = random(Graph, {rng: customRngFunction});

// To directly assign the positions to the nodes:
random.assign(Graph);

Arguments

  • graph Graph: target graph.
  • options ?object: options:
    • attributes ?object: attributes to map:
      • x ?string [x]: name of the x position.
      • y ?string [y]: name of the y position.
    • center ?number [0.5]: center of the layout.
    • rng ?function [Math.random]: custom RNG function to use.
    • scale ?number [1]: scale of the layout.