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

Consider changing add_edge(src, dst, e) to add_edge(e: impl IntoEdge) #51

Open
pnevyk opened this issue Apr 7, 2023 · 0 comments
Open
Labels
discussion High-level topic for discussion and brainstorming

Comments

@pnevyk
Copy link
Owner

pnevyk commented Apr 7, 2023

Advantages:

  • Cleaner (?) API for unweighted graphs: graph.add_edge((src, dst)) instead of graph.add_edge(src, dst, ()).

Disadvantages:

  • Worse documentation? add_edge(&mut self, src: VertexIndex, dst: VertexIndex, edge: E) is much clearer than add_edge<T: IntoEdge<VertexIndex, E, Ty>>(&mut self, edge: T).
  • Potential problems with type inference. Especially in case of encapsulations where we don't use G::VertexIndex directly, but VI: Borrow<G::VertexIndex> instead.

In summary, I am not much in favor of this change, but just wanted to leave a note if I change the opinion and the disadvantages will turn out not that bad.

@pnevyk pnevyk added the discussion High-level topic for discussion and brainstorming label Apr 7, 2023
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