JSPM

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

Miscellaneous utils for graphology.

Package Exports

  • graphology-utils
  • graphology-utils/add-path
  • graphology-utils/add-star
  • graphology-utils/is-graph
  • graphology-utils/is-graph-constructor

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-utils) 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 Utils

Miscellaneous utils to be used with graphology.

Installation

npm install graphology-utils

Usage

#.addPath

Function adding a path to the given graph.

import Graph from 'graphology';
import {addPath} from 'graphology-utils';
// Alternatively, if you want to only load the relevant code:
import addPath from 'graphology-utils/add-path';

const graph = new Graph();

addPath(graph, [1, 2, 3, 4, 5]);
graph.edges().map(e => graph.extremities(e));
>>> [[1, 2], [2, 3], [3, 4], [4, 5]]

Arguments

  • graph Graph: target graph.
  • path array: array of nodes representing the path to add.

#.addStar

Function adding a star to the given graph.

import Graph from 'graphology';
import {addStar} from 'graphology-utils';
// Alternatively, if you want to only load the relevant code:
import addStar from 'graphology-utils/add-star';

const graph = new Graph();

addStar(graph, [1, 2, 3, 4, 5]);
graph.edges().map(e => graph.extremities(e));
>>> [[1, 2], [1, 3], [1, 4], [1, 5]]

Arguments

  • graph Graph: target graph.
  • star array: array of nodes representing the star to add.

#.isGraph

Function returning whether the given value is a graphology implementation's instance.

import Graph from 'graphology';
import {isGraph} from 'graphology-utils';
// Alternatively, if you want to only load the relevant code:
import isGraph from 'graphology-utils/is-graph';

const graph = new Graph();

isGraph(graph);
>>> true

isGraph(45);
>>> false

isGraph({hello: 'world'});
>>> false

Arguments

  • value any: value to test.

#.isGraphConstructor

Function returning whether the given value is a graphology constructor.

import Graph from 'graphology';
import {isGraphConstructor} from 'graphology-utils';
// Alternatively, if you want to only load the relevant code:
import isGraphConstructor from 'graphology-utils/is-graph-constructor';

isGraphConstructor(Graph);
>>> true

isGraphConstructor(45);
>>> false

isGraphConstructor(new Graph());
>>> false

Arguments

  • value any: value to test.