meta-struct-js

0.1.8 • Public • Published

MetaStruct.Graph

MetaStruct.Graph - directed acyclic graph.


Graph Invariants:

  • has only one root node;
  • has no non-connected nodes;
  • has no cycles;
  • has exit (at least one);

Graph Creation

  • create node Graph.Node:
import Graph from 'MetaStruct'

Graph.Node.create(
  _your_uuid_, // autogenerated uuid by default
  _your_labels_, // [] by default
  _your_properties_ // {} by default
)
  • create edge Graph.Edge:
Graph.Edge.create(
  _your_left_node_, // an instance of Graph.Node
  _your_right_node_, // an instance of Graph.Node
  _your_labels_, // [] by default
  _your_properties_, // {} by default
  _your_weight_ // 0 by default
)
  • build graph Graph:
    • fails on duplicated nodes (nodes with duplicated uuids);
    • fails on duplicated edges (duplicated edge objects wich have identical left and right nodes);
    • fails on situation, when node has no edge entity (presented in edge list);
    • fails on situation, when edge has node which is not presented in node list;
Graph.create(
  _your_array_of_nodes_, // [] by default
  _your_array_of_edges // [] by default
)

Build and Development

  • code style checking:
npm run lint
  • development mode:
npm run start
  • run tests:
npm run test // -- with using сoverage statement

Package Sidebar

Install

npm i meta-struct-js

Weekly Downloads

8

Version

0.1.8

License

MIT

Unpacked Size

97.2 kB

Total Files

57

Last publish

Collaborators

  • elenik72