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

Question: edge indices #104

Closed
hdavid16 opened this issue Jan 23, 2023 · 1 comment
Closed

Question: edge indices #104

hdavid16 opened this issue Jan 23, 2023 · 1 comment

Comments

@hdavid16
Copy link
Collaborator

Is there a particular reason why edges are being referenced with the integer index rather than the edge itself (or src, dst tuple)? I'm curious because Graphs.jl doesn't support indexed edges and there is some debate there on this: JuliaGraphs/Graphs.jl#127

@hexaeder
Copy link
Collaborator

hexaeder commented Jan 24, 2023

The real reason: I have a background in power grid simulations using NetworkDynamics.jl, that packages references edges by their index so that choice seemed natural, because that in its relatively easy to align colors with edge states (as in the Stress on Truss Example).

However, there are some real arguments on can make: Internally we often need to loop over all edges, edge properties and edge related information (such as the path representing the edge). IMO its much easier if you can just have arrays for all of that with the convention that their order matches the edges(g) iterator. Makes zipping, mapping and broadcasting simpler and you don't need to have the same keyset everywhere.

Eventually #89 might be nice addition for the user interface to allow to pass parameters as dicts with the Edge object as key.

Tangentially related: for multigraph support #52 it might be nice to switch to our own edge iterator, something like drawable_edges(g) which defaults to edges(g) for SimpleGraphs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants