-
Notifications
You must be signed in to change notification settings - Fork 49
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
Dot digraph colours #330
Dot digraph colours #330
Conversation
doc/z-chap9.xml
Outdated
@@ -3,7 +3,9 @@ | |||
<Section><Heading>Visualising a digraph</Heading> | |||
<#Include Label="Splash"> | |||
<#Include Label="DotDigraph"> | |||
<#Include Label="DotColoredDigraph"> |
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.
This line isn't necessary, and is probably what is causing the CI to fail, I suggest removing it.
doc/z-chap9.xml
Outdated
<#Include Label="DotSymmetricDigraph"> | ||
<#Include Label="DotSymmetricColoredDigraph"> |
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.
Same for this one.
doc/display.xml
Outdated
@@ -98,9 +99,40 @@ gap> Splash(DotDigraph(RandomDigraph(4))); | |||
</ManSection> | |||
<#/GAPDoc> | |||
|
|||
<#GAPDoc Label="DIGRAPHS_DotDigraph"> |
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 usually document functions starting DIGRAPHS_
these are treated as (kind of) private internal functions/methods.
doc/attr.xml
Outdated
@@ -133,6 +133,30 @@ gap> DigraphNrEdges(D); | |||
</ManSection> | |||
<#/GAPDoc> | |||
|
|||
<#GAPDoc Label="DigraphNrLoops"> |
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.
This chunk shouldn't be here, looks like you've branched DotDigraphColours
off DigraphNrLoops
but you should have done it from the master
branch.
Thanks for the PR @marinaanagno ! Obviously the CI is failing, I think you need to make a few changes, as mentioned in the comments before having another 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.
See the comments.
9a26093
to
e8c8e6b
Compare
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.
This looks pretty good! The only thing that's really missing is checks that the argument "colors" are valid (i.e. that you can't get the code you've written to error inside it by providing incorrect arguments) and that the documentation should indicate the requirements of these arguments too. Otherwise, this looks good!
doc/display.xml
Outdated
<Returns>A string.</Returns> | ||
<Description> | ||
This function produces a graphical representation of the symmetric | ||
digraph <A>digraph</A>. <C>DotSymmetricDigraph</C> will return an | ||
error if <A>digraph</A> is not a symmetric digraph. See | ||
<Ref Prop="IsSymmetricDigraph"/>.<P/> | ||
|
||
The function <C>DotSymmetricColoredDigraph</C> differs from <C>DotDigraph</C> | ||
only in |
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.
Please remove the line break here.
doc/display.xml
Outdated
@@ -110,6 +111,10 @@ gap> Splash(DotDigraph(RandomDigraph(4))); | |||
vertices, with the arrowhead of each line pointing towards the range | |||
of the edge.<P/> | |||
|
|||
<C>DotColoredDigraph</C> differs from <C>DotDigraph</C> only in | |||
that the values in given in the two lists are used to color the vertices and | |||
edges of the graph when displayed. <P/> |
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 think you should add more details about what values the arguments can have. I.e. what are the possible "colors" of the vertices and edges? what if I want to specify vertex colors but not edge colors, or vice versa? the list of edge colors has to have the same "shape" as the list of Outneighbours
right?
gap/display.gi
Outdated
vert[i], ", style=filled]")], | ||
[{i, j} -> Concatenation("[color=", | ||
edge[i][j], "]")])); | ||
# return DIGRAPHS_DotDigraph(D, |
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.
Add a comment that the method above can be replaced with the commented out one when/if Digraphs requires GAP version ??.
[IsDigraphByOutNeighboursRep], | ||
function(D) | ||
local out, str, i, j; | ||
return DIGRAPHS_DotDigraph(D, [i -> Concatenation(" [label=\"", | ||
String(DigraphVertexLabel(D, i)), "\"]")], []); |
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.
Same as above, please add a comment.
gap/display.gi
Outdated
"for a digraph by out-neighbours and two lists", | ||
[IsDigraphByOutNeighboursRep, IsList, IsList], | ||
function(D, vert, edge) | ||
return DIGRAPHS_DotSymmetricDigraph(D, |
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 happens if the list of colors (edge or vertex) is not valid? I.e. if the list is too short? Or has holes?
gap/display.gi
Outdated
", style=filled]")], | ||
[{i, j} -> Concatenation("[color=", | ||
edge[i][j], "]")]); | ||
# return DIGRAPHS_DotSymmetricDigraph(D, |
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.
Add a comment as above.
We made the suggested changes and also we created some new functions |
@marinaanagno I'm not sure that you've pushed your changes, can you please double check? If you've addressed my comments, then they should be showing as "outdated", and at present they aren't. |
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 discussed this just now, and the only outstanding thing to do is to check that the "color" arguments to these functions are valid.
…lled doesn't work yet)
b5a416b
to
4dc16e4
Compare
Thank you for adding this! I like it. |
Glad to hear that! :) |
Added coloured options for vertices and edges in DotDigraph and DotSymmetricDigraph. We also used a global variable so that DotDigraph, DotVertexLabelledDigraph, DotColoredDigraph, DotSymmetricDigraph and DotSymmetricColoredDigraph do not have repeated code.