Goto Chapter: Top 1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C Bib Ind

### 14 Dot functions

#### 14.1 Dot functions

We provide several functions to translate graphs, Hasse diagrams or trees related to numerical and affine semigroups to the dot language. This can either be used with graphviz or any javascript library that interprets dot language. We give the alternative to use DotSplash that uses viz.js.

##### 14.1-1 DotBinaryRelation
 ‣ DotBinaryRelation( br ) ( function )

br is a binary relation. Returns a GraphViz dot that represents the binary relation br. The set of vertices of the resulting graph is the source of br. Edges join those elements which are related with respect to br.

gap> br:=BinaryRelationByElements(Domain([1,2]), [Tuple([1,2])]);
<general mapping: <object> -> <object> >
gap> Print(DotBinaryRelation(br));
digraph  NSGraph{rankdir = TB; edge[dir=back];
1 [label="1"];
2 [label="2"];
2 -> 1;
}


##### 14.1-2 HasseDiagramOfNumericalSemigroup
 ‣ HasseDiagramOfNumericalSemigroup( S, A ) ( function )

S is a numerical semigroup and A is a set of integers. Returns a binary relation which is the Hasse diagram of A with respect to the ordering apreceq b if b - a in S.

gap> s:=NumericalSemigroup(3,5,7);;
gap> HasseDiagramOfNumericalSemigroup(s,[1,2,3]);
<general mapping: <object> -> <object> >


##### 14.1-3 HasseDiagramOfBettiElementsOfNumericalSemigroup
 ‣ HasseDiagramOfBettiElementsOfNumericalSemigroup( S ) ( function )

S is a numerical semigroup. Applies HasseDiagramOfBettiElementsOfNumericalSemigroup with arguments S and its Betti elements.

gap> s:=NumericalSemigroup(3,5,7);;
gap> HasseDiagramOfBettiElementsOfNumericalSemigroup(s);
<general mapping: <object> -> <object> >


##### 14.1-4 HasseDiagramOfAperyListOfNumericalSemigroup
 ‣ HasseDiagramOfAperyListOfNumericalSemigroup( S[, n] ) ( function )

S is a numerical semigroup, n is an integer (optional, if not provided, the multiplicity of the semigroup is taken as its value). Applies HasseDiagramOfBettiElementsOfNumericalSemigroup (14.1-3) with arguments S and the Apéry set of S with respect to n.

gap> s:=NumericalSemigroup(3,5,7);;
gap> HasseDiagramOfAperyListOfNumericalSemigroup(s);
<general mapping: <object> -> <object> >
gap> HasseDiagramOfAperyListOfNumericalSemigroup(s,10);
<general mapping: <object> -> <object> >


##### 14.1-5 DotTreeOfGluingsOfNumericalSemigroup
 ‣ DotTreeOfGluingsOfNumericalSemigroup( S ) ( function )

S is a numerical semigroup. It outputs a tree (in dot) representing the many ways S can be decomposed as a gluing of numerical semigroups (and goes recursively in the factors).

gap> s:=NumericalSemigroup(4,6,9);;
gap> Print(DotOverSemigroupsNumericalSemigroup(s));
digraph  NSGraph{rankdir = TB;
0 [label="〈 4, 6, 9 〉"];
0 [label="〈 4, 6, 9 〉", style=filled];
1 [label="〈 4 〉 + 〈 6, 9 〉" , shape=box];
2 [label="〈 1 〉", style=filled];
3 [label="〈 2, 3 〉", style=filled];
4 [label="〈 2 〉 + 〈 3 〉" , shape=box];
5 [label="〈 1 〉", style=filled];
6 [label="〈 1 〉", style=filled];
7 [label="〈 4, 6 〉 + 〈 9 〉" , shape=box];
8 [label="〈 2, 3 〉", style=filled];
10 [label="〈 2 〉 + 〈 3 〉" , shape=box];
11 [label="〈 1 〉", style=filled];
12 [label="〈 1 〉", style=filled];
9 [label="〈 1 〉", style=filled];
0 -> 1;
1 -> 2;
1 -> 3;
3 -> 4;
4 -> 5;
4 -> 6;
0 -> 7;
7 -> 8;
7 -> 9;
8 -> 10;
10 -> 11;
10 -> 12;
}


##### 14.1-6 DotOverSemigroupsNumericalSemigroup
 ‣ DotOverSemigroupsNumericalSemigroup( S ) ( function )

S is a numerical semigroup. It outputs the Hasse diagram (in dot) of oversemigroups of S.

gap> s:=NumericalSemigroup(4,6,9);;
gap> Print(DotOverSemigroupsNumericalSemigroup(s));
digraph  NSGraph{rankdir = TB; edge[dir=back];
1 [label="〈 1 〉", style=filled];
2 [label="〈 2, 3 〉", style=filled];
3 [label="〈 2, 5 〉", style=filled];
4 [label="〈 2, 7 〉", style=filled];
5 [label="〈 2, 9 〉", style=filled];
6 [label="〈 3, 4, 5 〉", style=filled];
7 [label="〈 3, 4 〉", style=filled];
8 [label="〈 4, 5, 6, 7 〉"];
9 [label="〈 4, 5, 6 〉", style=filled];
10 [label="〈 4, 6, 7, 9 〉"];
11 [label="〈 4, 6, 9, 11 〉"];
12 [label="〈 4, 6, 9 〉", style=filled];
1 -> 2;
2 -> 3;
2 -> 6;
3 -> 4;
3 -> 8;
4 -> 5;
4 -> 10;
5 -> 11;
6 -> 7;
6 -> 8;
7 -> 10;
8 -> 9;
8 -> 10;
9 -> 11;
10 -> 11;
11 -> 12;
}


##### 14.1-7 DotRosalesGraph
 ‣ DotRosalesGraph( n, S ) ( operation )
 ‣ DotRosalesGraph( n, S ) ( operation )

S is either numerical or an affine semigroup and n is an element in S. It outputs the graph associated to n in S (see GraphAssociatedToElementInNumericalSemigroup (4.1-2)).

gap> s:=NumericalSemigroup(4,6,9);;
gap> Print(DotRosalesGraph(15,s));
graph  NSGraph{
1 [label="6"];
2 [label="9"];
2 -- 1;
}


##### 14.1-8 DotFactorizationGraph
 ‣ DotFactorizationGraph( f ) ( operation )

f is a set of factorizations. Returns the graph (in dot) of factorizations associated to f: a complete graph whose vertices are the elements of f. Edges are labelled with distances between the nodes they join. Kruskal algorithm is used to draw in red a spanning tree with minimal distances. Thus the catenary degree is reached in the edges of the tree.

gap> f:=FactorizationsIntegerWRTList(20,[3,5,7]);
[ [ 5, 1, 0 ], [ 0, 4, 0 ], [ 1, 2, 1 ], [ 2, 0, 2 ] ]
gap> Print(DotFactorizationGraph(f));
graph  NSGraph{
1 [label=" (5, 1, 0)"];
2 [label=" (0, 4, 0)"];
3 [label=" (1, 2, 1)"];
4 [label=" (2, 0, 2)"];
2 -- 3[label="2", color="red"];
3 -- 4[label="2", color="red"];
1 -- 3[label="4", color="red"];
1 -- 4[label="4" ];
2 -- 4[label="4" ];
1 -- 2[label="5" ];
}


##### 14.1-9 DotEliahouGraph
 ‣ DotEliahouGraph( f ) ( operation )

f is a set of factorizations. Returns the Eliahou graph (in dot) of factorizations associated to f: a graph whose vertices are the elements of f, and there is an edge between two vertices if they have common support. Edges are labelled with distances between nodes they join.

gap> f:=FactorizationsIntegerWRTList(20,[3,5,7]);
[ [ 5, 1, 0 ], [ 0, 4, 0 ], [ 1, 2, 1 ], [ 2, 0, 2 ] ]
gap> Print(DotEliahouGraph(f));
graph  NSGraph{
1 [label=" (5, 1, 0)"];
2 [label=" (0, 4, 0)"];
3 [label=" (1, 2, 1)"];
4 [label=" (2, 0, 2)"];
2 -- 3[label="2" ];
3 -- 4[label="2" ];
1 -- 3[label="4" ];
1 -- 4[label="4" ];
1 -- 2[label="5" ];
}


##### 14.1-10 SetDotNSEngine
 ‣ SetDotNSEngine( engine ) ( function )

This function sets the value of DotNSEngine to engine, which must be any of the following "circo","dot","fdp","neato","osage","twopi". This tells viz.js which graphviz engine to use.

gap> SetDotNSEngine("circo");
true


Here is an example with the default dot engine

And one with circo engine

##### 14.1-11 DotSplash
 ‣ DotSplash( [dots] ) ( function )

Launches a browser and visualizes the dots diagrams provided as arguments. It outputs the html page displayed as a string, and prints the location of the temporary file that contains it.

Goto Chapter: Top 1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C Bib Ind

generated by GAPDoc2HTML