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
Update dot option definitions to latest (2015) #89
Conversation
Thank you very much for your effort to add the "new" dot options! I hope you missed none ;-) |
Of course. |
fc5b0f0
to
b637b62
Compare
Rebased and added new test. Passing fine. |
Ups, did not see your rebase. Please have a look at master which now contains two commits containing your changes from #88. Could you please rebase your branch (attributes2015) onto origin/master. |
a7302bd
to
7c8d95a
Compare
I cherry-picked the relevant commits on a fresh copy of current master. Tests passing. I think we're good. |
99c3c83
to
a18d9e9
Compare
Do you think it is easy to have a test, which validates the output of |
I'm actually already working on a test that validates all node and edge options. I was planning to add this as another pull request because I will need some more time to define the proper examples that show the actual results of the options. However, I currently wouldn't know how to compare the graphical output to some test. I am using the comparison and just putting out an image file as well. Maybe I can use the resulting SVG to compare against and see if the actual SVG tags are correct. If you know how to compare a fixture png to something the test produces I'm happy to learn how to do this. |
Since I switched to python for day to day work, I am not firm with ruby test libraries. |
Do you have a pointer on how this would be done in Python?
…On Fri, Mar 24, 2023, 17:29 Horst Duchêne ***@***.***> wrote:
Maybe I can use the resulting SVG to compare against and see if the actual
SVG tags are correct. If you know how to compare a fixture png to something
the test produces I'm happy to learn how to do this.
Since I switched to python for day to day work, I am not firm with ruby
test libraries. pytest is really good defining fixtures. But a simple
file diff could also work.
—
Reply to this email directly, view it on GitHub
<#89 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABFRJXXIWNY2ADV6FUNAKHLW5XDXLANCNFSM6AAAAAAWBCQA3Q>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
I have a problem using the new version. This simple example does not show the expected result: dg = RGL::DirectedAdjacencyGraph[1,2]
dg.set_vertex_options(1, shape: 'tab', fontcolor: 'blue')
dg.set_edge_options(1, 2, color: 'blue')
dg.write_to_graphic_file graph.dot: digraph RGL__DirectedAdjacencyGraph {
1 [
fontsize = 8,
label = 1
]
2 [
fontsize = 8,
label = 2
]
1 -> 2 [
fontsize = 8
]
} What am I doing wrong? I think we must have more documentation in |
About fixtures — pytest documentation This is what I would use in python |
You need to set up the options hashes edge_options and vertex_options with dg = RGL::DirectedAdjacencyGraph[1,2]
dg.set_vertex_options(1, shape: 'tab', fontcolor: 'blue')
dg.set_edge_options(1, 2, color: 'blue')
get_vertex_setting = proc { |v| dg.vertex_options[v] }
get_edge_setting = proc { |u, v| dg.edge_options[dg.edge_class.new(u, v)] }
vertex_options = {
'shape' => get_vertex_setting,
'fontcolor' => get_vertex_setting,
}
edge_options = {
'color' => get_edge_setting,
}
dot_options = { 'edge' => edge_options, 'vertex' => vertex_options }.to_s
dg.write_to_graphic_file(dot_options) Maybe we should just provide this whole hash populated with all values through dot.rb and the user just has to worry about which parameters to pass to the methods. Let me think about how this can handle defaults that should be applied to everything. I liked that with the current approach you have a specific list of options that you want to use and can override with defaults for all edges/nodes if you want. This is also hard coded for a couple of things like name in The question would be if it's acceptable to have the method just listen to any of the available options and if the user wants to have a default value assigned via the methods they must make sure to implement calling the method with the parameter each time. I'm not very sure either way. I like the current way but it needs more explanation. |
This is proving harder than I thought. There is something wrong (or I don't get it) between the edge options assignemnt and the way dot reads it. I'm going to dig more. |
The convenience thing for the settings is separate from this PR. Could we move forward with updating the dot option definitions. The provided test already covers the new options. Once I have more results for the exhaustive tests or the convenience improvement for the settings methods I'd add new PRs. |
OK.
Can you file an issue or PR which describes the problem to be solved, so that we can refer to it in the release notes later. Thereafter we can merge this PR. |
Align comments for graph options
Fix keyword for dir in edge config and assertion Fix name for comment quoting tests Fix name for comment quoting tests Fix test comment method names
ada2d61
to
2cd1bac
Compare
Rebased this to #94, this should give us a direct line to have the convenient options handling and all the new attributes. |
The rdot.rb file had outdated definitions for the available options. I've updated this to best of my knowledge. This addresses a comment from #61
discussion #61 (comment)
Definitions taken from the linked 2015 version: https://www.graphviz.org/pdf/dotguide.pdf