Skip to content
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

Merged
merged 15 commits into from
Sep 17, 2020
Merged

Conversation

marinaanagno
Copy link
Contributor

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.

doc/z-chap9.xml Outdated
@@ -3,7 +3,9 @@
<Section><Heading>Visualising a digraph</Heading>
<#Include Label="Splash">
<#Include Label="DotDigraph">
<#Include Label="DotColoredDigraph">
Copy link
Member

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">
Copy link
Member

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">
Copy link
Member

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">
Copy link
Member

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.

@james-d-mitchell
Copy link
Member

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.

Copy link
Member

@james-d-mitchell james-d-mitchell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the comments.

@marinaanagno marinaanagno force-pushed the DotDigraphColours branch 2 times, most recently from 9a26093 to e8c8e6b Compare July 15, 2020 14:21
Copy link
Member

@james-d-mitchell james-d-mitchell left a 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
Copy link
Member

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/>
Copy link
Member

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,
Copy link
Member

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)), "\"]")], []);
Copy link
Member

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,
Copy link
Member

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,
Copy link
Member

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.

@marinaanagno
Copy link
Contributor Author

We made the suggested changes and also we created some new functions DotVertexColoredDigraph DotEdgeColoredDigraph, DotSymmetricVertexColoredDigraph and DotSymmetricEdgeColoredDigraph that colour edges and vertices independently.

@james-d-mitchell
Copy link
Member

@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.

@james-d-mitchell james-d-mitchell added the new-feature A label for new features. label Aug 19, 2020
Copy link
Member

@james-d-mitchell james-d-mitchell left a 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.

@james-d-mitchell james-d-mitchell merged commit 8384e54 into digraphs:master Sep 17, 2020
@wilfwilson
Copy link
Collaborator

Thank you for adding this! I like it.

@marinaanagno
Copy link
Contributor Author

Thank you for adding this! I like it.

Glad to hear that! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-feature A label for new features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants