1.0.0-alpha.1 • Published 4 months ago

graph-by-ivan-tulaev v1.0.0-alpha.1

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

graph-by-ivan-tulaev

Graph library for traversing and processing any directional graphs.

Description

  • Working with direction graphs.
  • Has utility functions for elements CRUD operations (nodes & edges)
  • Customise graph traversing with genericTraversing
  • Get independent sub-graphs with getSeparatedGraphs
  • Check if there is a path between two nodes in different directions with isNodeTraced
  • Has some popular functions for customisation traversing in traversingFunctions

Traverse customisation

Use genericTraversing in Graph class for create your own graph traversing algorithm.

callbacks

  • getStartElement: (visited: Set, initialGraph: Graph) => N | undefined
    • get node to start or repeat iteration after executionSequence is empty
    • stop iteration when undefined
  • getNextFromExecutionSequence: (executionSequence: Array) => N | undefined
    • get next elements from executionSequence
    • in some cases it is best way to use .pop()... in some cases .shift()
  • getNextNodes: (node: N, graph: Graph, visited: Set) => Array | undefined
    • for get next nodes
    • these can be outgoing, incoming or other specific nodes
    • stop iteration when undefined
  • addNextNodesToExecutionSequence: (nodes: Array, executionSequence: Array) => void
    • add nodes to executionSequence
    • in some cases it is best way to use .push()... in some cases .unshift()
  • executeCurrent?: (node: N) => void
    • for current node processing

examples

For callbacks examples you can check getSeparatedGraphs() and isNodeTraced() in Graph class

License

MIT

1.0.0-alpha.1

4 months ago

0.0.8

4 months ago

0.0.6

4 months ago

0.0.5

4 months ago

0.0.4

4 months ago

0.0.3

4 months ago

0.0.2

4 months ago

0.0.1

4 months ago