Skip to content

MetaStruct - a collection of strongly business-oriented variants of commonly used data structures such as graphs, lists and etc.

License

Notifications You must be signed in to change notification settings

0exp/meta_struct

Repository files navigation

MetaStruct

MetaStruct - a collection of strongly business-oriented variants of commonly used data structures such as graphs, lists and etc.


Table of usage


MetaStruct::Graph

MetaStruct::Graph - directed acyclic graph. Realized as a representational data structure (without mutation interfaces).


Graph Invariants:

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

Graph Creation

  • create node MetaStruct::Graph::Node:
MetaStruct::Graph::Node.create(
  uuid: _your_uuid_, # autogenerated via SecureRandom.uuid by default
  labels: _your_labels_, # [] by default
  properties: _your_properties_ # {} by default
)
  • create edge MetaStruct::Graph::Edge:
MetaStruct::Graph::Edge.create(
  left_node: _your_left_node_, # an instance of MetaStruct::Graph::Node
  right_node: _your_right_node_, # an instance of MetaStruct::Graph::Node
  labels: _your_labels_, # [] by default
  properties: _your_properties_, # {} by default
  weight: _your_weight_ # 0 by default
)
  • build graph MetaStruct::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;
MetaStruct::Graph.create(
  nodes: _your_array_of_nodes_, # [] by default
  edges: _your_array_of_edges # [] by default
)

Contributing

  • Fork it ( https://github.com/0exp/meta_struct/fork )
  • Create your feature branch (git checkout -b feature/my-new-feature)
  • Commit your changes (git commit -am '[my-new-featre] Add some feature')
  • Push to the branch (git push origin feature/my-new-feature)
  • Create new Pull Request

License

Released under MIT License.

Authors

Rustam Ibragimov

About

MetaStruct - a collection of strongly business-oriented variants of commonly used data structures such as graphs, lists and etc.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published