-
Notifications
You must be signed in to change notification settings - Fork 21
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
Add directed-graph?
and undirected-graph?
#64
Comments
Yes this is a good idea. We might need to think about a few corner cases though. Like what should happen if someone calls |
Currently, I think ideally it would instead only add one edge (or error?), but that would be a breaking change. The best way to follow the current behavior would be to have I'm honestly having trouble thinking of use cases which require a graph to be changed from undirected to directed or vice versa. (In my case, the user gives a graph to my library but I don't need to modify it.) |
Actually, I forgot that the internal struct is not exported, only constructors that already distinguish directed/undirected (eg, Maybe create two substructs (one for directed one for undirected) that have the existing struct as a super struct? |
If they are different substructs, what happens when you call Also, having 4 total substructs (weighted/unweighted, directed/undirected) might be messy. |
I think the right thing to do is to to error. But that might make things even more complicated since I think we would have to split the methods to the two structs as well. I think that's the cleaner design though. 4 structs might be slightly more verbose but they represent 4 distinct variations so it makes sense. I agree it would be easier to add a What do you think? |
In that case, it might make sense to combine |
oh that's a good point. That's would definitely be a breaking change though. Let me think about it some more |
Also to think about, 4 structs would mean Would you be okay with a flag if it was immutable (such that calling |
Hi, I would like to be able to tell if a graph is directed or undirected. Would it be possible to add this to the interface and implement it by:
add-directed-edge!
set it to trueI will add it but wanted to make sure that this implementation would be acceptable.
The text was updated successfully, but these errors were encountered: