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

GraphIterator trait #16

Open
pnevyk opened this issue Feb 13, 2022 · 0 comments
Open

GraphIterator trait #16

pnevyk opened this issue Feb 13, 2022 · 0 comments
Labels
discussion High-level topic for discussion and brainstorming

Comments

@pnevyk
Copy link
Owner

pnevyk commented Feb 13, 2022

GraphIterator trait would be a variation on Iterator from the standard library, requiring to implement just "next" functionality (probably next_vertex and next_edge, but I haven't thought about the details at all yet) and providing iterator-like functionality that makes sense to do for graphs. A list of such functionality (not exhaustive):

  • map(v, e), map_vertices(v), map_edges(e)
  • filter(v, e), filter_vertices(v), filter_edges(e)
  • filter_map
  • count -> (v, e), vertex_count -> v, edge_count -> e
  • collect -> G with G generic type implementing a trait

When consuming, vertices are always processed first and edges second (existence of an edge is dependent on its endpoint(s) not being removed), which may impose some implementation challenges.

@pnevyk pnevyk added the discussion High-level topic for discussion and brainstorming label Feb 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion High-level topic for discussion and brainstorming
Projects
None yet
Development

No branches or pull requests

1 participant