Semigroups icon indicating copy to clipboard operation
Semigroups copied to clipboard

Better dot

Open james-d-mitchell opened this issue 1 year ago • 2 comments

This is just a proof of concept, not intended to be merged just yet.

james-d-mitchell avatar Mar 13 '24 15:03 james-d-mitchell

This will probably fail until both:

https://github.com/digraphs/graphviz/pull/21

and

https://github.com/digraphs/Digraphs/pull/644

are merged.

james-d-mitchell avatar May 15 '24 12:05 james-d-mitchell

Here's a badly edited bug that currently exists in this PR and should be fixed before merging:

gap> F := FreeMonoid("c", "d");
<free monoid on the generators [ c, d ]>
gap> AssignGeneratorVariables(F);
#I  Assigned the global variables [ c, d ]
gap> R := ParseRelations([c, d], "c^2=c, dc=d, cd^2=d^2, d^5=d^2");
[ [ c^2, c ], [ d*c, d ], [ c*d^2, d^2 ], [ d^5, d^2 ] ]
gap> S := F / R;
<fp monoid with 2 generators and 4 relations of length 20>
gap> Splash(DotLeftCayleyDigraph(S));
#I  Using GeneratorsOfMonoid not GeneratorsOfSemigroup for the Cayley graph
gap> AsSemigroup(S);
<fp monoid with 2 generators and 4 relations of length 20>
gap> AsSemigroup(IsFpSemigroup, S);
<fp semigroup with 3 generators and 9 relations of length 36>
gap> Splash(DotLeftCayleyDigraph(S));
#I  Using GeneratorsOfMonoid not GeneratorsOfSemigroup for the Cayley graph
gap> S := last2;
<fp monoid with 2 generators and 4 relations of length 20>
gap> Splash(DotLeftCayleyDigraph(S));
#I  Using GeneratorsOfMonoid not GeneratorsOfSemigroup for the Cayley graph
gap> S := last2;
<fp semigroup with 3 generators and 9 relations of length 36>
gap> Splash(DotLeftCayleyDigraph(S));
Error: not well-formed (invalid token) in line 2
... <td align="right" port="port1"><identity ...> ...
gap> Print(DotLeftCayleyDigraph(S))
> ;
//dot
digraph hgn {
	node [shape=circle] node [shape="box"]
	1 [color="#00ff00", label="<identity ...>", style=filled]
	2 [color="#ff00ff", label=c, style=filled]
	3 [color="#007fff", label=d, style=filled]
	4 [label=cd]
	5 [label="d^2"]
	6 [label="d^3"]
	7 [label="d^4"]
	1 -> 1 [color="#00ff00"]
	1 -> 2 [color="#ff00ff"]
	1 -> 3 [color="#007fff"]
	2 -> 2 [color="#00ff00"]
	2 -> 2 [color="#ff00ff"]
	2 -> 3 [color="#007fff"]
	3 -> 3 [color="#00ff00"]
	3 -> 4 [color="#ff00ff"]
	3 -> 5 [color="#007fff"]
	4 -> 4 [color="#00ff00"]
	4 -> 4 [color="#ff00ff"]
	4 -> 5 [color="#007fff"]
	5 -> 5 [color="#00ff00"]
	5 -> 5 [color="#ff00ff"]
	5 -> 6 [color="#007fff"]
	6 -> 6 [color="#00ff00"]
	6 -> 6 [color="#ff00ff"]
	6 -> 7 [color="#007fff"]
	7 -> 7 [color="#00ff00"]
	7 -> 7 [color="#ff00ff"]
	7 -> 5 [color="#007fff"]
// legend context
	node [shape=plaintext]
subgraph legend {
	head [label=<<table border="0" cellpadding="2" cellspacing="0" cellborder="0">
<tr><td align="right" port="port1"><identity ...>&nbsp;</td></tr>
<tr><td align="right" port="port2">c&nbsp;</td></tr>
<tr><td align="right" port="port3">d&nbsp;</td></tr>
</table>>
]
	tail [label=<<table border="0" cellpadding="2" cellspacing="0" cellborder="0">
<tr><td align="right" port="port1">&nbsp;</td></tr>
<tr><td align="right" port="port2">&nbsp;</td></tr>
<tr><td align="right" port="port3">&nbsp;</td></tr>
</table>>
]
	head:port1:e
	tail:port1:w
	head:port1:e -> tail:port1:w [color="#00ff00", constraint=false]
	head:port2:e
	tail:port2:w
	head:port2:e -> tail:port2:w [color="#ff00ff", constraint=false]
	head:port3:e
	tail:port3:w
	head:port3:e -> tail:port3:w [color="#007fff", constraint=false]
}
	node [shape=circle] node [shape="box"]

}

james-d-mitchell avatar May 15 '24 13:05 james-d-mitchell