Graph support
itsSaad opened this issue · 4 comments
Does this gem support graph data structures as well
The Gem does not explicitly support graphs, as this feature requires cycle detection functionality. However, it should be relatively easy to make it happen (the nodes can refer to other nodes in the tree.
will it be easy to run dijkstras algo on it?
Perhaps or depends. If you are trying to depict the graph itself, then do remember that the gem does work on a node-by-node basis, but some of the methods assume that it is a Tree (i.e., there is a ROOT, child nodes, etc.), whereas what you need is pure nodes with a peer relationship, not the hierarchical one that a tree imposes.
However, I think it will be possible to use RubyTree as a graph as well, provided the cycle detection is handled by the client code. It will actually be very interesting to check this out.
On the other hand, if you are trying to use RubyTree as a scratch-space during the length computations for Dijkstra's algorithm, then it is an immediate fit (though a stack or a heap would also work equally well).
thanks for your help.