-
Notifications
You must be signed in to change notification settings - Fork 9
Add a mapping from edges to paths with the dummy nodes #6
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
Conversation
src/layering.jl
Outdated
| for out_node in copy(outneighbors(graph, cur_node)) # need to copy as outwise will mutate when the graph is mutated | ||
| for out_edge in filter(e -> e.src == cur_node, collect(edges(graph))) # need to copy as outwise will mutate when the graph is mutated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to change from iterating the outneighbors to iterating edges to make it work with WeightedGraphs, I couldn't find how to get back to the WeightedEdge with just the src and dst vertices in a generic way. Maybe there's a better way to do it ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i am not sure. I don't know light graphs that well
Aside: Apparently the rtight way to get the soource is not e.src but rather src(e)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need the collect if we are using filter as filter creates a copy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apparently the rtight way to get the soource is not e.src but rather src(e)
fixed
We don't need the collect if we are using filter as filter creates a copy
filter on a SimpleEdgeIter throws an MethodError, so I left the collect for now
| @@ -1,5 +1,5 @@ | |||
| is_dag(g) = is_directed(g) && !is_cyclic(g) | |||
| dag_or_error(g) = is_dag(g) || DomainError(g, "Only Directed Acylic Graphs are supported") | |||
| dag_or_error(g) = is_dag(g) || throw(DomainError(g, "Only Directed Acylic Graphs are supported")) | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch.
|
Why don't we have a function then the current I don't fully understand this new structure of |
|
Well my use case is plotting the output of some maxflow problem. So that's why I went with a mapping from the edges in the original graph to paths in the full graph |
|
Ah, I see. Needs doc strings explaining what paths is. |
|
New docstring looks great. why is CI failing? |
|
Sure, julia-actions/julia-uploadcoveralls fails on nightly, and that cancels the build on julia stable, but the tests pass successfuly. |
|
I have added the plots to the readme. |
README.md
Outdated
| As you can see in the first plot below, pathing though the dummy nodes actually guarantees minimal number of crossings. | ||
| On the _tiny_depgaph_ example direct has 3 crossings, where as path through dummy node only 2). | ||
| However, it also doesn't actually always look as nice. | ||
| It might look as nice if you used some swishy Bezier curves though. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Shall we change them all to use that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know, it surely looks better but it doesn't help explaining what is returned in paths
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if we stick a scatter plot on top with big markers dummy nodes,
or insert the letter X in place of the node name for dummy nodes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or we could leave as is, maybe adding mention of the curves function in the comment in the readme?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| It might look as nice if you used some swishy Bezier curves though. | |
| It might nicer if you used some swishy Bezier curves though (Plots.jl has a [curves attribute](http://docs.juliaplots.org/latest/generated/graph_attributes/), and a matching function, which does this) |
|
Sorry, I lost track of this. Also want to decide what to do with |
|
Rebasing this should fix the CI |
|
bump, this would be good to have |
|
Rebased it, sorry for the delay, hard to find motivation these days :) |
Big Mood. |

This makes
solve_positionsalso return a Dict which is a mapping from edges in the original graph to paths in the graph with dummy nodes used to solve the layout problem.The Dict has for keyset
edges(g)and it's values are tuples of vectors :xandycoordinates.I updated the examples with the output we get by plotting these paths, but the simpler examples don't look so great :