Hi all,
I am trying to store an undirected graph in OrientDB, and I have a few questions on this:
1. I looked through the documentation, and I see APIs for "in edges" and "out edges" which seem to assume a directed graph. If I am trying to store an undirected graph, then would I need to add two edges every time I want to add a shared edge between two vertices? I.e.
i. Add an out-edge to vertex 1, going to vertex 2
ii. Add an out-edge to vertex 2, going to vertex 1
(Ignore in-edges? Or do in-edges get added automatically when an out-edge is added?)
Is there a better way to accomplish this?
2. Is there a fast way to get all the "neighbors" of a vertex? Right now the way that I see to do this, is to get all the out-edges from a vertex (assuming I follow the method I described in (1) of creating the reverse out-edges for every edge added), and then get the "outVertex"es from those edges. But in this case, I would need to loop through every edge one by one, which seems like it would be slow. Is there some optimized way to just get all the immediate neighbors? (And in future, I may want to get neighbors-of-neighbors, too. Is there an efficient way of doing that?)
Any help would be appreciated, thanks!
-Sid