-
Notifications
You must be signed in to change notification settings - Fork 115
Open
Labels
bugSomething isn't workingSomething isn't workingenhancementNew feature or requestNew feature or request
Description
Edges for SimpleGraph still consider their directedness when testing for equality and hashing. This is understandable given that SimpleEdge is used for directed graphs also. Is it worth considering adding a SimpleUndirectedEdge (or similar)? Something along the lines of:
...
function ==(e1::SimpleUndirectedEdge, e2::SimpleUndirectedEdge)
return (src(e1) == src(e2) && dst(e1) == dst(e2)) ||
(src(e1) == dst(e2) && dst(e1) == src(e2))
end
hash(e::SimpleUndirectedEdge, h::UInt) = hash(src(e), h) ⊻ hash(dst(e), h)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.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingenhancementNew feature or requestNew feature or request