-
Notifications
You must be signed in to change notification settings - Fork 56
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
ENH: Add function to visualize presentation #380
Conversation
Thanks, this will be great to have. It should probably go in to_graphviz_graph(pres::Presentation) = [your code]
to_graphviz(pres::Presentation) = to_graphviz(to_graphviz_graph(pres)) Then users can just call the generic function |
Ah, maybe the way to do this is by taking the layout from Graphviz, and then outputting the actual figure using Compose or TikZ. Is code for doing stuff like this already in Catlab? The real cool way of doing this would be for Catlab to output a graph that could be opened by some program and then the layout could be specified manually by dragging and dropping. |
OK, I think I want to merge this at the current level of functionality, so I'm requesting a review. |
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 agree, this will be very handy! I left one inline comment.
Also, this function should have a test of some kind. The minimal effort approach is to write a unit test that checks some basic invariant of the Graphviz graph. Another nice thing (not required) to do for graphics stuff is to create a Literate.jl vignette in the docs. For example, see this vignette for the Graphviz wiring diagrams. It doubles as a "visual test" that will also break the build if the code errors. It shouldn't be too much work to just copy the examples you've been playing with.
Re: the possibility of other graphics backends, Catlab actually does support parsing graph layouts from the JSON output of Graphviz; see parse_graphviz
. You could pursue this in a follow-up PR if you get the itch.
I agree that Evan's inline comment and then LGTM |
To be clear, I am going to insist on some form of testing, however minimal :) |
Thanks Owen! Merging now. |
This is just a simple function to draw the generating morphisms in a presentation in graph form.
Questions:
I will clean up code and add docstrings, but also I would like answers to those questions. Also, I just realized that I need to specialize this to
Presentation{Schema}
.The generated graph for Graph looks like this:
![image](https://user-images.githubusercontent.com/4728903/106218905-51d04080-61a6-11eb-8ae2-e79b7fb0460b.png)