Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow nodes and edges to be tagged? #15

Open
wylee opened this issue Oct 21, 2019 · 0 comments
Open

Allow nodes and edges to be tagged? #15

wylee opened this issue Oct 21, 2019 · 0 comments
Assignees

Comments

@wylee
Copy link
Owner

wylee commented Oct 21, 2019

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 wylee self-assigned this Oct 21, 2019
@wylee wylee added the v3 label Oct 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant