Dijkstar
Dijkstar copied to clipboard
Allow nodes and edges to be tagged?
One use case for this would be to find nodes and edges with a given attribute value without having to iterate through all the nodes or edges. Possible API:
g = Graph()
g.add_edge(1, 2, tags={'type': 'highway'})
g.add_edge(2, 3, tags={'type': 'highway'})
highways = g.get_edges_by_tag(type='highway')
Internal tag storage might be a list:
def add_edge(self, u, v, edge=None, tags=None):
...
if tags:
self.tags.edges['type'].append(edge)