Skip to content

Commit 2d9c3bf

Browse files
alicealice
authored andcommitted
changes to documentation/tests
1 parent e8305cc commit 2d9c3bf

6 files changed

Lines changed: 199 additions & 181 deletions

File tree

gap/NautyGraph.gd

Lines changed: 166 additions & 161 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,160 @@ DeclareCategory( "IsNautyGraphWithNodeLabels",
2222
IsNautyGraph );
2323

2424

25+
#! @BeginGroup NautyGraph
26+
#! @Description
27+
#! This function creates a nauty graph object for an undirected graph without
28+
#! multiple edges, but possibly with loops,
29+
#! whose edges are given by the list <A>edges</A>. The list
30+
#! <A>edges</A> is a list whose entries are lists of length 2, consisting of
31+
#! the two (possibly equal) vertices of the edges. If two edges are either
32+
#! equal or one is the reversed of the other, the graph created will still
33+
#! only have a single undirected edge. The graph created is on
34+
#! the vertices <A>1, .., nr, </A> where <A>nr</A> is the maximal entry
35+
#! occurring in one of the edges. If the function is called with a second
36+
#! argument <A>nr</A> then <A>nr</A> must be a positive integer which is at
37+
#! least equal to the maximal entry occurring in one of the edges.
38+
#!
39+
#!
40+
#! @BeginExampleSession
41+
#! gap> ng := NautyGraph( [ [1,2], [2,3], [3,4], [4,1], [3,2] ] );
42+
#! <An undirected Nauty graph with on 4 vertices>
43+
#! gap>
44+
#! [ [ 1, 2 ], [ 2, 3 ], [ 3, 4 ], [ 4, 1 ], [ 3, 2 ] ]
45+
#! @EndExampleSession
46+
#!
47+
#! @Returns a <K>NautyGraph</K>
48+
#! @Arguments edges
49+
#! @Arguments edges nr
50+
DeclareOperation( "NautyGraph", [ IsList ] );
51+
DeclareOperation( "NautyGraph", [ IsList, IsInt ] );
52+
#! @EndGroup
53+
54+
#! @BeginGroup NautyDiGraph
55+
#! @Description
56+
#! This function creates a nauty graph object for a directed graph without
57+
#! multiple edges, but possibly with loops, whose edges are given by the
58+
#! list <A>edges</A>. The list
59+
#! <A>edges</A> is a list whose entries are lists of length 2, consisting of
60+
#! the two (possibly equal) vertices of the edges. If two edges are
61+
#! equal the graph created will still
62+
#! only have a single directed edge. The graph created is on
63+
#! the vertices <A>1, .., nr, </A> where <A>nr</A> is the maximal entry
64+
#! occurring in one of the edges. If the function is called with a second
65+
#! argument <A>nr</A> then <A>nr</A> must be a positive integer which is at
66+
#! least equal to the maximal entry occurring in one of the edges.
67+
#!
68+
#!
69+
#! @BeginExampleSession
70+
#! gap> nautygraph := NautyDiGraph( [ [1,2],[2,3],[3,4], [4,1] ] );
71+
#! <A directed Nauty graph on 4 vertices>
72+
#! gap> AutomorphismGroup(nautygraph);
73+
#! Group([ (1,2,3,4) ])
74+
#! @EndExampleSession
75+
#!
76+
#! @Returns a <K>NautyGraph</K>
77+
#! @Arguments edges
78+
#! @Arguments edges nr
79+
DeclareOperation( "NautyDiGraph", [ IsList ] );
80+
DeclareOperation( "NautyDiGraph", [ IsList, IsInt ] );
81+
#! @EndGroup
82+
83+
#! @BeginGroup NautyColoredGraph
84+
#! @Description
85+
#! This function creates a nauty graph object for an undirected
86+
#! vertex coloured graph without
87+
#! multiple edges, but possibly with loops, whose edges are given by the
88+
#! list <A>edges</A>. The list
89+
#! <A>edges</A> is a list whose entries are lists of length 2, consisting of
90+
#! the two (possibly equal) vertices of the edges. If two edges are
91+
#! equal or reversed to each other the graph created will still
92+
#! only have a single undirected edge. The graph created is on
93+
#! the vertices <A>1, .., nr, </A> where <A>nr</A> is the maximal entry
94+
#! occurring in one of the edges. The list <A>colours</A> must be a
95+
#! list of length <A>nr</A> whose entries are positive integers. The
96+
#! vertex <A>i</A> has colour <A>colours[i]</A>.
97+
#!
98+
#!
99+
#! @BeginExampleSession
100+
#! gap> nautygraph := NautyColoredGraph( [ [1,2],[2,3],[3,4], [4,1] ], [1,2,1,2] );
101+
#! <An undirected vertex-coloured Nauty graph on 4 vertices>
102+
#! gap> AutomorphismGroup(nautygraph);
103+
#! Group([ (2,4), (1,3) ])
104+
#! @EndExampleSession
105+
#!
106+
#! @Returns a <K>NautyGraph</K>
107+
#! @Arguments edges
108+
#! @Arguments edges colours
109+
DeclareOperation( "NautyColoredGraph", [ IsList, IsList ] );
110+
#! DeclareSynonym( "NautyColouredGraph", NautyColoredGraph );
111+
#! @EndGroup
112+
113+
#! @BeginGroup NautyColouredDiGraph
114+
#! @Description
115+
#! This function creates a nauty graph object for an undirected
116+
#! vertex coloured graph without
117+
#! multiple edges, but possibly with loops, whose edges are given by the
118+
#! list <A>edges</A>. The list
119+
#! <A>edges</A> is a list whose entries are lists of length 2, consisting of
120+
#! the two (possibly equal) vertices of the edges. If two edges are
121+
#! equal or reversed to each other the graph created will still
122+
#! only have a single undirected edge. The graph created is on
123+
#! the vertices <A>1, .., nr, </A> where <A>nr</A> is the maximal entry
124+
#! occurring in one of the edges. The list <A>colours</A> must be a
125+
#! list of length <A>nr</A> whose entries are positive integers. The
126+
#! vertex <A>i</A> has colour <A>colours[i]</A>.
127+
#!
128+
#!
129+
#! @BeginExampleSession
130+
#! gap> nautygraph := NautyColoredGraph( [ [1,2],[2,3],[3,4], [4,1] ], [1,2,1,2] );
131+
#! <An undirected vertex-coloured Nauty graph on 4 vertices>
132+
#! gap> AutomorphismGroup(nautygraph);
133+
#! Group([ (2,4), (1,3) ])
134+
#! @EndExampleSession
135+
#!
136+
#! @Returns a <K>NautyGraph</K>
137+
#! @Arguments edges colours
138+
DeclareOperation( "NautyColoredDiGraph", [ IsList, IsList ] );
139+
#! DeclareSynonym( "NautyColouredDiGraph", NautyColoredDiGraph );
140+
#! @EndGroup
141+
142+
#! @BeginGroup NautyEdgeColoredGraph
143+
#! @Description
144+
#! This function creates a nauty graph object for an undirected
145+
#! edge coloured graph without
146+
#! multiple edges, but possibly with loops. The edges of the graph
147+
#! are specified in the argument <A>edgeclasses</A> as follows.
148+
#! <A>edgeclasses</A> is a list of lists <M>L_i</M>, where each list
149+
#! <M>L_i</M> is a list of edges, that is <M>L_i</M> is a list
150+
#! a list whose entries are lists of length 2, consisting of
151+
#! the two (possibly equal) vertices of the edges. If two edges are
152+
#! equal or reversed to each other the graph created will still
153+
#! only have a single undirected edge. The graph created is on
154+
#! the vertices <A>1, .., nr, </A> where <A>nr</A> is the maximal entry
155+
#! occurring in one of the edges. The edges in the <M>i</M>th list
156+
#! <M>L_i</M> have colour <M>i</M>.
157+
#!
158+
#!
159+
#! @BeginExampleSession
160+
#! gap> nautygraph := NautyEdgeColoredGraph( [ [[1,2],[2,3]],[[3,4], [4,1]]]);
161+
#! <An undirected edge-coloured Nauty graph on 4 vertices and 2 edge colours>
162+
#! gap> AutomorphismGroup(nautygraph);
163+
#! Group([ (1,3) ])
164+
#! @EndExampleSession
165+
#!
166+
#! @Returns a <K>NautyGraph</K>
167+
#! @Arguments edgeclasses colours
168+
DeclareOperation( "NautyEdgeColoredGraph", [ IsList ] );
169+
DeclareOperation( "NautyEdgeColoredGraph", [ IsList, IsInt] );
170+
DeclareOperation( "NautyEdgeColoredDiGraph", [ IsList ] );
171+
DeclareOperation( "NautyEdgeColoredDiGraph", [ IsList, IsInt] );
172+
#! DeclareSynonym( "NautyEdgeColouredGraph", NautyEdgeColoredGraph );
173+
#! DeclareSynonym( "NautyEdgeColouredDiGraph", NautyEdgeColoredDiGraph );
174+
#! @EndGroup
175+
176+
DeclareGlobalFunction( "CALL_NAUTY_ON_GRAPH_AND_SET_PROPERTIES" );
177+
DeclareGlobalFunction( "CALL_NAUTY_ON_EDGE_COLORED_GRAPH" );
178+
25179
#!
26180
#! @BeginGroup AutomorphismGroup
27181
#! @Description
@@ -48,7 +202,7 @@ DeclareCategory( "IsNautyGraphWithNodeLabels",
48202
#!
49203
#! @BeginExampleSession
50204
#! gap> nautygraph := NautyGraph( [ [1,2],[2,3],[3,4], [4,1] ] );
51-
#! <A Nauty graph>
205+
#! <An undirected Nauty graph with on 4 vertices>
52206
#! gap> AutomorphismGroup(nautygraph);
53207
#! Group([ (2,4), (1,2)(3,4) ])
54208
#! @EndExampleSession
@@ -71,7 +225,7 @@ DeclareAttribute( "AutomorphismGroupGenerators", IsNautyGraph );
71225
#!
72226
#! @BeginExampleSession
73227
#! gap> nautygraph := NautyGraph( [ [1,2],[2,3],[3,4], [4,1] ] );
74-
#! <A Nauty graph with on 4 vertices>
228+
#! <An undirected Nauty graph with on 4 vertices>
75229
#! gap> EdgesOfNautyGraph(nautygraph);
76230
#! [ [ 1, 2 ], [ 2, 3 ], [ 3, 4 ], [ 4, 1 ] ]
77231
#! @EndExampleSession
@@ -89,9 +243,9 @@ DeclareAttribute( "Edges", IsNautyGraph );
89243
#!
90244
#! @BeginExampleSession
91245
#! gap> nautygraph := NautyGraph( [ [1,2],[2,3],[3,4], [4,1] ] );
92-
#! <A Nauty graph with on 4 vertices>
246+
#! #! <An undirected Nauty graph with on 4 vertices>
93247
#! gap> VerticesOfNautyGraph(nautygraph);
94-
#! [ [ 1, 2 ], [ 2, 3 ], [ 3, 4 ], [ 4, 1 ] ]
248+
#! [ 1 .. 4 ]
95249
#! @EndExampleSession
96250
#!
97251
#! @Returns a list of positive integers
@@ -108,7 +262,7 @@ DeclareOperation( "Vertices", [IsNautyGraph] );
108262
#!
109263
#! @BeginExampleSession
110264
#! gap> ng := NautyColoredGraph( [ [1,2], [2,3], [3,4], [4,1], [3,2] ], [1,2,1,2] );
111-
#! <A Nauty graph with on 4 vertices>
265+
#! <An undirected vertex-coloured Nauty graph on 4 vertices>
112266
#! gap> VertexColoursOfNautyGraph(ng);
113267
#! [ 1, 2, 1, 2 ]
114268
#! @EndExampleSession
@@ -131,7 +285,7 @@ DeclareAttribute( "VertexColoursOfNautyGraph", IsNautyGraph);
131285
#!
132286
#! @BeginExampleSession
133287
#! gap> ng := NautyGraph( [ [1,3], [2,3], [2,5], [4,5], [5,1] ] );
134-
#! <A Nauty graph with on 5 vertices>
288+
#! <An undirected Nauty graph with on 5 vertices>
135289
#! gap> canrep := CanonicalForm(ng);
136290
#! <An undirected Nauty graph with on 5 vertices>
137291
#! gap> EdgesOfNautyGraph(canrep);
@@ -161,15 +315,15 @@ DeclareAttribute( "CanonicalForm", IsNautyGraph );
161315
#!
162316
#! @BeginExampleSession
163317
#! gap> ng := NautyGraph( [ [1,3], [2,3], [2,5], [4,5], [5,1] ] );
164-
#! <A Nauty graph with on 5 vertices>
318+
#! <An undirected Nauty graph with on 5 vertices>
165319
#! gap> perm := CanonicalLabeling(ng);
166320
#! (1,4,3,2)
167-
#! gap> canrep := NautyGraph(OnSetsSets(EdgesOfNautyGraph(ng), p^-1));
321+
#! gap> canrep := NautyGraph(List(Set(EdgesOfNautyGraph(ng)),i->OnTuples(i,perm^-1)));
168322
#! <An undirected Nauty graph with on 5 vertices>
169-
#! gap> EdgesOfNautyGraph(canrep);
170-
#! [ [ 1, 5 ], [ 2, 4 ], [ 2, 5 ], [ 3, 4 ], [ 3, 5 ] ]
171-
#! gap> CanonicalLabeling(canrep);
172-
#! ()
323+
#! gap> EdgesOfNautyGraph(canrep);
324+
#! [ [ 2, 4 ], [ 3, 4 ], [ 3, 5 ], [ 1, 5 ], [ 5, 2 ] ]
325+
#! gap> CanonicalLabeling(ng);
326+
#! (1,4,3,2)
173327
#! @EndExampleSession
174328
#!
175329
#! @Returns a permutation
@@ -248,152 +402,3 @@ DeclareGlobalFunction( "CREATE_NAUTY_GRAPH_OBJECT" );
248402
DeclareGlobalFunction( "CREATE_NAUTY_EDGE_COLORED_GRAPH" );
249403

250404

251-
#! @BeginGroup NautyGraph
252-
#! @Description
253-
#! This function creates a nauty graph object for an undirected graph without
254-
#! multiple edges, but possibly with loops,
255-
#! whose edges are given by the list <A>edges</A>. The list
256-
#! <A>edges</A> is a list whose entries are lists of length 2, consisting of
257-
#! the two (possibly equal) vertices of the edges. If two edges are either
258-
#! equal or one is the reversed of the other, the graph created will still
259-
#! only have a single undirected edge. The graph created is on
260-
#! the vertices <A>1, .., nr, </A> where <A>nr</A> is the maximal entry
261-
#! occurring in one of the edges. If the function is called with a second
262-
#! argument <A>nr</A> then <A>nr</A> must be a positive integer which is at
263-
#! least equal to the maximal entry occurring in one of the edges.
264-
#!
265-
#!
266-
#! @BeginExampleSession
267-
#! gap> ng := NautyGraph( [ [1,2], [2,3], [3,4], [4,1], [3,2] ] );
268-
#! <A Nauty graph with on 4 vertices>
269-
#! gap> EdgesOfNautyGraph(ng);
270-
#! [ [ 1, 2 ], [ 1, 4 ], [ 2, 3 ], [ 3, 4 ] ]
271-
#! @EndExampleSession
272-
#!
273-
#! @Returns a <K>NautyGraph</K>
274-
#! @Arguments edges
275-
#! @Arguments edges nr
276-
DeclareOperation( "NautyGraph", [ IsList ] );
277-
DeclareOperation( "NautyGraph", [ IsList, IsInt ] );
278-
#! @EndGroup
279-
280-
#! @BeginGroup NautyDiGraph
281-
#! @Description
282-
#! This function creates a nauty graph object for a directed graph without
283-
#! multiple edges, but possibly with loops, whose edges are given by the
284-
#! list <A>edges</A>. The list
285-
#! <A>edges</A> is a list whose entries are lists of length 2, consisting of
286-
#! the two (possibly equal) vertices of the edges. If two edges are
287-
#! equal the graph created will still
288-
#! only have a single directed edge. The graph created is on
289-
#! the vertices <A>1, .., nr, </A> where <A>nr</A> is the maximal entry
290-
#! occurring in one of the edges. If the function is called with a second
291-
#! argument <A>nr</A> then <A>nr</A> must be a positive integer which is at
292-
#! least equal to the maximal entry occurring in one of the edges.
293-
#!
294-
#!
295-
#! @BeginExampleSession
296-
#! gap> nautygraph := NautyDiGraph( [ [1,2],[2,3],[3,4], [4,1] ] );
297-
#! <A Nauty graph>
298-
#! gap> AutomorphismGroup(nautygraph);
299-
#! Group([ (1,2,3,4) ])
300-
#! @EndExampleSession
301-
#!
302-
#! @Returns a <K>NautyGraph</K>
303-
#! @Arguments edges
304-
#! @Arguments edges nr
305-
DeclareOperation( "NautyDiGraph", [ IsList ] );
306-
DeclareOperation( "NautyDiGraph", [ IsList, IsInt ] );
307-
#! @EndGroup
308-
309-
#! @BeginGroup NautyColoredGraph
310-
#! @Description
311-
#! This function creates a nauty graph object for an undirected
312-
#! vertex coloured graph without
313-
#! multiple edges, but possibly with loops, whose edges are given by the
314-
#! list <A>edges</A>. The list
315-
#! <A>edges</A> is a list whose entries are lists of length 2, consisting of
316-
#! the two (possibly equal) vertices of the edges. If two edges are
317-
#! equal or reversed to each other the graph created will still
318-
#! only have a single undirected edge. The graph created is on
319-
#! the vertices <A>1, .., nr, </A> where <A>nr</A> is the maximal entry
320-
#! occurring in one of the edges. The list <A>colours</A> must be a
321-
#! list of length <A>nr</A> whose entries are positive integers. The
322-
#! vertex <A>i</A> has colour <A>colours[i]</A>.
323-
#!
324-
#!
325-
#! @BeginExampleSession
326-
#! gap> nautygraph := NautyColoredGraph( [ [1,2],[2,3],[3,4], [4,1] ], [1,2,1,2] );
327-
#! <A Nauty graph with on 4 vertices>
328-
#! gap> AutomorphismGroup(nautygraph);
329-
#! Group([ (2,4), (1,3) ])
330-
#! @EndExampleSession
331-
#!
332-
#! @Returns a <K>NautyGraph</K>
333-
#! @Arguments edges
334-
#! @Arguments edges colours
335-
DeclareOperation( "NautyColoredGraph", [ IsList, IsList ] );
336-
#! @EndGroup
337-
338-
#! @BeginGroup NautyColoredDiGraph
339-
#! @Description
340-
#! This function creates a nauty graph object for an undirected
341-
#! vertex coloured graph without
342-
#! multiple edges, but possibly with loops, whose edges are given by the
343-
#! list <A>edges</A>. The list
344-
#! <A>edges</A> is a list whose entries are lists of length 2, consisting of
345-
#! the two (possibly equal) vertices of the edges. If two edges are
346-
#! equal or reversed to each other the graph created will still
347-
#! only have a single undirected edge. The graph created is on
348-
#! the vertices <A>1, .., nr, </A> where <A>nr</A> is the maximal entry
349-
#! occurring in one of the edges. The list <A>colours</A> must be a
350-
#! list of length <A>nr</A> whose entries are positive integers. The
351-
#! vertex <A>i</A> has colour <A>colours[i]</A>.
352-
#!
353-
#!
354-
#! @BeginExampleSession
355-
#! gap> nautygraph := NautyColoredGraph( [ [1,2],[2,3],[3,4], [4,1] ], [1,2,1,2] );
356-
#! <A Nauty graph with on 4 vertices>
357-
#! gap> AutomorphismGroup(nautygraph);
358-
#! Group([ (2,4), (1,3) ])
359-
#! @EndExampleSession
360-
#!
361-
#! @Returns a <K>NautyGraph</K>
362-
#! @Arguments edges colours
363-
DeclareOperation( "NautyColoredDiGraph", [ IsList, IsList ] );
364-
#! @EndGroup
365-
366-
#! @BeginGroup NautyEdgeColoredGraph
367-
#! @Description
368-
#! This function creates a nauty graph object for an undirected
369-
#! edge coloured graph without
370-
#! multiple edges, but possibly with loops. The edges of the graph
371-
#! are specified in the argument <A>edgeclasses</A> as follows.
372-
#! <A>edgeclasses</A> is a list of lists <M>L_i</M>, where each list
373-
#! <M>L_i</M> is a list of edges, that is <M>L_i</M> is a list
374-
#! a list whose entries are lists of length 2, consisting of
375-
#! the two (possibly equal) vertices of the edges. If two edges are
376-
#! equal or reversed to each other the graph created will still
377-
#! only have a single undirected edge. The graph created is on
378-
#! the vertices <A>1, .., nr, </A> where <A>nr</A> is the maximal entry
379-
#! occurring in one of the edges. The edges in the <M>i</M>th list
380-
#! <M>L_i</M> have colour <M>i</M>.
381-
#!
382-
#!
383-
#! @BeginExampleSession
384-
#! gap> nautygraph := NautyEdgeColoredGraph( [ [[1,2],[2,3]],[[3,4], [4,1]] ], [1,4] );
385-
#! <A Nauty graph with on 4 vertices>
386-
#! gap> AutomorphismGroup(nautygraph);
387-
#! Group([ (2,4), (1,3) ])
388-
#! @EndExampleSession
389-
#!
390-
#! @Returns a <K>NautyGraph</K>
391-
#! @Arguments edgeclasses colours
392-
DeclareOperation( "NautyEdgeColoredGraph", [ IsList ] );
393-
DeclareOperation( "NautyEdgeColoredGraph", [ IsList, IsInt] );
394-
DeclareOperation( "NautyEdgeColoredDiGraph", [ IsList ] );
395-
DeclareOperation( "NautyEdgeColoredDiGraph", [ IsList, IsInt] );
396-
#! @EndGroup
397-
398-
DeclareGlobalFunction( "CALL_NAUTY_ON_GRAPH_AND_SET_PROPERTIES" );
399-
DeclareGlobalFunction( "CALL_NAUTY_ON_EDGE_COLORED_GRAPH" );

gap/NautyGraph.gi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@ InstallMethod( CanonicalForm,
652652
fi;
653653
od;
654654
fi;
655-
# edges := Set( permEdges );
655+
edges := Set( permEdges );
656656

657657
if IsColored( graph ) then
658658
colors := graph!.colors;

0 commit comments

Comments
 (0)