Hello TG Team,
I noticed that two undirected edges with fromId and toId reversed are not equal, but I want to treat them as the same since I set them as undirected in the first place.
Say I have two sets of edges, one contain some reversed versions of the edges in the other set. If I try to find the intersection of the two sets, the result would be different from what I expect, as the reversed edges are not treated as the same. So the workaround is to create reversed edges in both sets, and to do so I have to go opposite directions each time I traverse to find the reversed edges.
My question is that is there a better way of reversing edges? Maybe there exists an edge function I don’t know of? Or is there a better way to compare reversed edges so that the direction wouldn’t matter.
You can tried to defined a tuple type like this:
TYPEDEF TUPLE <f VERTEX, t VERTEX> UDEDGE
and it should provide equivalence as you want
I would need to see the solution to be sure, but if your looking for two unique paths you should create two directed edges.
Think about the relationship how Corporations own Corporations that could themselves own more Corporations. You could create one direct edge called “has_parent”. and another directed edge 'has_child". This would make your schema design more intuitive for others to traverse the graph.
You can do this with one undirected edge with attributes for parent and another for children. Because a parent can have multiple children, you will have to use LIST as the attribute data type.
Using an undirected edge will not be as performant as two directed edges. Anytime you have to read an attribute and evaluate the data it takes CPU cycles. By using two directed edges you reduced the number of edges and attributes you need to transverse.
Let me know if I can help you further.