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
Graphology Layout
Collection of basic layout algorithms to be used with graphology
.
Installation
npm install graphology-layout
Usage
#.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.
- x ?string [
- center ?number [
0.5
]: center of the layout. - scale ?number [
1
]: scale of the layout.
- attributes ?object: attributes to map:
#.random
Random layout positionning 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.
- x ?string [
- center ?number [
0.5
]: center of the layout. - rng ?function [
Math.random
]: custom RNG function to use. - scale ?number [
1
]: scale of the layout.
- attributes ?object: attributes to map: