I want to build an undirected graph in Django. I have built an edge model with two foreign keys (first,second) to the node class, but there is a conflict with the related_name. I can use first_set and second_set, but since the graph is undirected, it doesn't matter if it is being liked to or from. What is the recommended way to deal with this scenario?
Edit: Here are roughly the models I'm working with:
class Node(models.Model):
#some irrelevant stuff
class Edge(models.Model):
#some other stuff
first = models.ForeignKey('Node',related_name=None)
second = models.ForeignKey('Node',related_name=None)
What I would like to have is some_node.connected_nodes_set
be something to the effect of a RelatedManager, similar to what would have been setup for either the first_set or second_set had I used related_names, except that it would have all of the nodes that can be reached with a single edge, instead of just those which can be reached in one direction.