meta-struct-js
v0.1.8
Published
Creation directed acyclic graph
Readme
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;
- fails on duplicated nodes (nodes with duplicated
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