Dijkstar icon indicating copy to clipboard operation
Dijkstar copied to clipboard

Allow nodes and edges to be tagged?

Open wylee opened this issue 6 years ago • 0 comments

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)

wylee avatar Oct 21 '19 22:10 wylee