-
Notifications
You must be signed in to change notification settings - Fork 93
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
Should undirected edges == and hash be undirected? #184
Comments
Ran into a related issue recently for a graph that had both directed and undirected edges. At the moment this is not supported by Graphs.jl but maybe with something along the lines what you propose it could be |
@DylanModesitt a PR would be welcome but I don't know whether it would break things. @simonschoelly thoughts? |
I am also afraid this might break things - perhaps this is something we can do in a next mayor release. For simplicity I would propose the types Edge # undirected edge
DiEdge # directed edge or maybe Something I did in SimpleValueGraphs.jl was to enforce in the constructor of that type, that the first vertex is always smaller than the second one. Then we don't need to check in |
Yeah the presence of directed edges in undirected graph is a major correctness footgun in my opinion. I like the idea of ordering by default, and I think deprecating |
Edges for
SimpleGraph
still consider their directedness when testing for equality and hashing. This is understandable given thatSimpleEdge
is used for directed graphs also. Is it worth considering adding aSimpleUndirectedEdge
(or similar)? Something along the lines of:And then having
SimpleGraph
instead return edges of this type by default?This would more easily allow users to maintain sets / dictionaries of edges. For instance, the reason I'm opening this is the associated awkwardness I encountered when implementing a minimum cycle basis that maintains such edge sets.
Happy to do a PR if this change is palatable.
The text was updated successfully, but these errors were encountered: