Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/attr.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1117,6 +1117,7 @@ gap> DigraphUndirectedGirth(D);
<#GAPDoc Label="ArticulationPoints">
<ManSection>
<Attr Name="ArticulationPoints" Arg="digraph"/>
<Attr Name="CutVertices" Arg="digraph"/>
<Returns>A list of vertices.</Returns>
<Description>
A connected digraph is <E>biconnected</E> if it is still connected (in the
Expand All @@ -1143,6 +1144,9 @@ gap> DigraphUndirectedGirth(D);
with articulation points, but no bridges.
<P/>

<Ref Attr="CutVertices"/> is a synonym for <Ref Attr="ArticulationPoints"/>.
<P/>

See also <Ref Prop="IsBiconnectedDigraph"/> and
<Ref Prop="IsBridgelessDigraph"/>.
<Example><![CDATA[
Expand Down
30 changes: 30 additions & 0 deletions doc/grahom.xml
Comment thread
mtorpey marked this conversation as resolved.
Resolved
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,36 @@ gap> DigraphWelshPowellOrder(Digraph([[4], [9], [9], [],
</ManSection>
<#/GAPDoc>

<#GAPDoc Label="DigraphSmallestLastOrder">
<ManSection>
<Attr Name="DigraphSmallestLastOrder" Arg="digraph"/>
<Returns> A list of vertices.</Returns>
<Description>
<C>DigraphSmallestLastOrder</C> returns a list <C>order</C> containing each
of the vertices of <A>digraph</A> in smallest-last order, defined as
follows: <P/>

Let <M>D_n</M> be <A>digraph</A>. For <M>i = n, n-1, \ldots, 1</M>, the
vertex <C>order[i]</C> is a vertex of minimum degree in <M>D_i</M>, and
<M>D_{i-1}</M> is the subdigraph of <M>D_i</M> induced by removing
<C>order[i]</C>. The degree of a vertex here is the sum of the number of
out- and in-neighbours. <P/>

The result is not unique in general, since there may be several vertices
of minimum degree at any step; <C>DigraphSmallestLastOrder</C> tiebreaks
by taking the smallest such vertex.
<Example><![CDATA[
gap> D1 := Digraph([[2], [1, 3], [2]]);;
gap> DigraphSmallestLastOrder(D1);
[ 3, 2, 1 ]
gap> D2 := CompleteDigraph(3);;
gap> DigraphSmallestLastOrder(D2);
[ 3, 2, 1 ]
]]></Example>
</Description>
</ManSection>
<#/GAPDoc>

<#GAPDoc Label="DigraphEmbedding">
<ManSection>
<Oper Name="DigraphEmbedding" Arg="digraph1, digraph2"/>
Expand Down
36 changes: 30 additions & 6 deletions doc/oper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1957,6 +1957,7 @@ rec( idom := [ 2, fail, 2, 2, 2 ], preorder := [ 2, 1, 3, 4, 5 ] )
<#GAPDoc Label="IsDigraphOutDominatingSet">
<ManSection>
<Oper Name="IsDigraphOutDominatingSet" Arg="digraph, list"/>
<Oper Name="IsDigraphDominatingSet" Arg="digraph, list"/>
<Oper Name="IsDigraphInDominatingSet" Arg="digraph, list"/>
<Returns><K>true</K> or <K>false</K>.</Returns>
<Description>
Expand All @@ -1973,7 +1974,10 @@ rec( idom := [ 2, fail, 2, 2, 2 ], preorder := [ 2, 1, 3, 4, 5 ] )
either in <M>S</M> or an out-neighbour of a vertex in <M>S</M>.
An <E>in-dominating set</E> of <A>digraph</A> is a subset <M>S</M> of
vertices of <A>digraph</A> such that every vertex of <A>digraph</A> is
either in <M>S</M> or an in-neighbour of a vertex in <M>S</M>.
either in <M>S</M> or an in-neighbour of a vertex in <M>S</M>. <P/>

<Ref Oper="IsDigraphDominatingSet"/> is a synonym for
<Ref Oper="IsDigraphOutDominatingSet"/>.

<Example><![CDATA[
gap> D := Digraph([[2, 4], [3], [1, 5], [3], [4]]);;
Expand Down Expand Up @@ -2290,6 +2294,7 @@ gap> DigraphDijkstra(D, 1, 2);
<#GAPDoc Label="ModularProduct">
<ManSection>
<Oper Name="ModularProduct" Arg="D1, D2"/>
<Oper Name="DigraphModularProduct" Arg="D1, D2"/>
<Returns>A digraph.</Returns>
<Description>
If <A>D1</A> and <A>D2</A> are digraphs without multiple edges, then
Expand All @@ -2313,7 +2318,10 @@ gap> DigraphDijkstra(D, 1, 2);
</List>

Notably, the complete (with loops) subdigraphs of <C>MPD</C> are
precisely the partial isomorphisms from <A>D1</A> to <A>D2</A>.
precisely the partial isomorphisms from <A>D1</A> to <A>D2</A>. <P/>

<Ref Oper="DigraphModularProduct"/> is a synonym for
<Ref Oper="ModularProduct"/>.

<Example><![CDATA[
gap> ModularProduct(Digraph([[1], [1, 2]]), Digraph([[], [2]]));
Expand All @@ -2333,6 +2341,7 @@ gap> ModularProduct(NullDigraph(0), CompleteDigraph(10));
<#GAPDoc Label="StrongProduct">
<ManSection>
<Oper Name="StrongProduct" Arg="D1, D2"/>
<Oper Name="DigraphStrongProduct" Arg="D1, D2"/>
<Returns>A digraph.</Returns>
<Description>
If <A>D1</A> and <A>D2</A> are digraphs without multiple edges,
Expand Down Expand Up @@ -2360,7 +2369,10 @@ gap> ModularProduct(NullDigraph(0), CompleteDigraph(10));
</List>

The SPD of two paths of lengths <C>m</C> and <C>n</C> is also the king's graph
for an <C>m</C> by <C>n</C> board.
for an <C>m</C> by <C>n</C> board. <P/>

<Ref Oper="DigraphStrongProduct"/> is a synonym for
<Ref Oper="StrongProduct"/>.

<Example><![CDATA[
gap> D1 := Digraph([[2], [1, 3, 4], [2, 5], [2, 5], [3, 4]]);
Expand All @@ -2380,6 +2392,7 @@ gap> StrongProduct(DigraphSymmetricClosure(ChainDigraph(3)),
<#GAPDoc Label="ConormalProduct">
<ManSection>
<Oper Name="ConormalProduct" Arg="D1, D2"/>
<Oper Name="DigraphConormalProduct" Arg="D1, D2"/>
<Returns>A digraph.</Returns>
<Description>
If <A>D1</A> and <A>D2</A> are digraphs without multiple edges,
Expand All @@ -2398,7 +2411,10 @@ gap> StrongProduct(DigraphSymmetricClosure(ChainDigraph(3)),
<Item>
There is an edge from <C>b</C> to <C>d</C> in <A>D2</A>.
</Item>
</List>
</List> <P/>

<Ref Oper="DigraphConormalProduct"/> is a synonym for
<Ref Oper="ConormalProduct"/>.

<Example><![CDATA[
gap> ConormalProduct(DigraphSymmetricClosure(CycleDigraph(7)),
Expand All @@ -2414,6 +2430,7 @@ gap> ConormalProduct(NullDigraph(0), CompleteDigraph(10));
<#GAPDoc Label="HomomorphicProduct">
<ManSection>
<Oper Name="HomomorphicProduct" Arg="D1, D2"/>
<Oper Name="DigraphHomomorphicProduct" Arg="D1, D2"/>
<Returns>A digraph.</Returns>
<Description>
If <A>D1</A> and <A>D2</A> are digraphs without multiple edges,
Expand All @@ -2433,7 +2450,10 @@ gap> ConormalProduct(NullDigraph(0), CompleteDigraph(10));
There is an edge from <C>a</C> to <C>c</C> in <A>D1</A> and no edge from
<C>b</C> to <C>d</C> in <A>D2</A>.
</Item>
</List>
</List> <P/>

<Ref Oper="DigraphHomomorphicProduct"/> is a synonym for
<Ref Oper="HomomorphicProduct"/>.

<Example><![CDATA[
gap> HomomorphicProduct(PetersenGraph(),
Expand Down Expand Up @@ -2476,6 +2496,7 @@ gap> OutNeighbours(D1);
<#GAPDoc Label="LexicographicProduct">
<ManSection>
<Oper Name="LexicographicProduct" Arg="D1, D2"/>
<Oper Name="DigraphLexicographicProduct" Arg="D1, D2"/>
<Returns>A digraph.</Returns>
<Description>
If <A>D1</A> and <A>D2</A> are digraphs without multiple edges,
Expand All @@ -2495,7 +2516,10 @@ gap> OutNeighbours(D1);
The vertices <C>a</C> and <C>c</C> of <A>D1</A> are equal and there is
an edge from <C>b</C> to <C>d</C> in <A>D2</A>.
</Item>
</List>
</List> <P/>

<Ref Oper="DigraphLexicographicProduct"/> is a synonym for
<Ref Oper="LexicographicProduct"/>.

<Example><![CDATA[
gap> LexicographicProduct(DigraphSymmetricClosure(CycleDigraph(3)),
Expand Down
5 changes: 4 additions & 1 deletion doc/prop.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1665,11 +1665,14 @@ false]]></Example>
<#GAPDoc Label="Is2EdgeTransitive">
<ManSection>
<Prop Name="Is2EdgeTransitive" Arg="digraph"/>
<Prop Name="IsTwoEdgeTransitive" Arg="digraph"/>
<Returns><K>true</K> or <K>false</K>.</Returns>
<Description>
If <A>digraph</A> is a digraph without multiple edges, then <C>Is2EdgeTransitive</C>
returns <K>true</K> if <A>digraph</A> is 2-edge transitive, and <K>false</K>
otherwise. If <A>digraph</A> has multiple edges, then <C>Is2EdgeTransitive</C> returns an error.
otherwise. If <A>digraph</A> has multiple edges, then <C>Is2EdgeTransitive</C> returns an error. <P/>

<Ref Prop="IsTwoEdgeTransitive"/> is a synonym for <Ref Prop="Is2EdgeTransitive"/>. <P/>

A digraph is <E>2-edge transitive</E> if its automorphism group
acts transitively on 2-edges via the action
Expand Down
66 changes: 56 additions & 10 deletions doc/weights.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
lists, whereas the function <C>EdgeWeightsMutableCopy</C> returns a copy
of <C>EdgeWeights</C> which is a mutable list of mutable lists.<P/>

The edge weights of a digraph cannot be computed and must be set either
using <C>SetEdgeWeights</C> or <Ref Func="EdgeWeightedDigraph" />.<P/>
The edge weights of a digraph are set upon construction with
<Ref Oper="EdgeWeightedDigraph"/>. <P/>
<Example><![CDATA[
gap> gr := EdgeWeightedDigraph([[2], [3], [1]], [[5], [10], [15]]);
<immutable edge-weighted digraph with 3 vertices, 3 edges>
Expand All @@ -47,15 +47,21 @@ Error, List Assignment: <list> must be a mutable list

<#GAPDoc Label="EdgeWeightedDigraph">
<ManSection>
<Func Name="EdgeWeightedDigraph" Arg="digraph, weights"/>
<Oper Name="EdgeWeightedDigraph" Arg="digraph, weights"/>
<Returns>A digraph or <K>fail</K></Returns>
<Description>
The argument <A>digraph</A> may be a digraph or a list of lists of integers, floats or rationals.<P/>
This function returns an immutable digraph with edge weights set to
<A>weights</A>. <P/>

<A>weights</A> must be a list of lists of integers, floats or rationals
of an equal size and shape to <C>OutNeighbours(digraph)</C>, otherwise it will fail.<P/>
If the argument <A>digraph</A> is a mutable digraph, then it is also
modified in place. <P/>

If the argument <A>digraph</A> is a list of lists of positive integers,
these are interpreted as out-neighbours for a digraph. <P/>

This will create a digraph and set the EdgeWeights to <A>weights</A>.<P/>
The argument <A>weights</A> must be a list of lists of integers, floats
or rationals, of an equal size and shape to
<C>OutNeighbours(digraph)</C>. <P/>

See <Ref Attr="EdgeWeights"/>.
<Example><![CDATA[
Expand All @@ -70,6 +76,27 @@ gap> EdgeWeights(g);
</ManSection>
<#/GAPDoc>

<#GAPDoc Label="UnitEdgeWeightedDigraph">
<ManSection>
<Oper Name="UnitEdgeWeightedDigraph" Arg="digraph"/>
<Returns>A digraph</Returns>
<Description>
This function returns an immutable digraph with all edge weights
set to <C>1</C>. If <A>digraph</A> is a mutable digraph,
then it is also modified in place. <P/>
See <Ref Attr="EdgeWeights"/>.
<Example><![CDATA[
gap> D := Digraph([[2], [1, 3], [1]]);
<immutable digraph with 3 vertices, 4 edges>
gap> D1 := UnitEdgeWeightedDigraph(D);
<immutable edge-weighted digraph with 3 vertices, 4 edges>
gap> EdgeWeights(D1);
[ [ 1 ], [ 1, 1 ], [ 1 ] ]
]]></Example>
</Description>
</ManSection>
<#/GAPDoc>

<#GAPDoc Label="EdgeWeightedDigraphTotalWeight">
<ManSection>
<Attr Name="EdgeWeightedDigraphTotalWeight" Arg="digraph"/>
Expand All @@ -91,6 +118,25 @@ gap> EdgeWeightedDigraphTotalWeight(D);
</ManSection>
<#/GAPDoc>

<#GAPDoc Label="IsNegativeEdgeWeightedDigraph">
<ManSection>
<Prop Name="IsNegativeEdgeWeightedDigraph" Arg="digraph"/>
<Returns>A boolean.</Returns>
<Description>
If <A>digraph</A> has edge weights, then this returns <K>true</K> if
at least one edge has negative weight, and <K>false</K> otherwise. If
<A>digraph</A> has no edge weights, then an error is raised.
<Example><![CDATA[
Comment thread
james-d-mitchell marked this conversation as resolved.
Resolved
gap> D := EdgeWeightedDigraph([[2], [1]], [[5], [10]]);;
gap> IsNegativeEdgeWeightedDigraph(D);
false
gap> D := EdgeWeightedDigraph([[2], [1]], [[-5], [10]]);;
gap> IsNegativeEdgeWeightedDigraph(D);
true]]></Example>
</Description>
</ManSection>
<#/GAPDoc>

<#GAPDoc Label="EdgeWeightedDigraphMinimumSpanningTree">
<ManSection>
<Attr Name="EdgeWeightedDigraphMinimumSpanningTree" Arg="digraph"/>
Expand Down Expand Up @@ -260,7 +306,7 @@ fail]]></Example>
the number of vertices of the digraph, and <M>e</M> is the number of
edges. <P/>

See <Ref Attr="EdgeWeights" Func="EdgeWeightedDigraph"/>.
See <Ref Attr="EdgeWeights"/>.
<Example><![CDATA[
gap> g := EdgeWeightedDigraph([[2, 2], [3], []], [[3, 2], [1], []]);
<immutable edge-weighted multidigraph with 3 vertices, 3 edges>
Expand Down Expand Up @@ -290,7 +336,7 @@ gap> Sum(flow[1]);
This attribute is computed by using <Ref Func="DigraphMaximumFlow"/> and the
max-cut min-flow theorem.<P/>

See <Ref Attr="EdgeWeights" Func="EdgeWeightedDigraph"/>.
See <Ref Attr="EdgeWeights"/>.
<Example><![CDATA[
gap> g := EdgeWeightedDigraph([[2, 2], [3], []], [[3, 2], [1], []]);
<immutable edge-weighted multidigraph with 3 vertices, 3 edges>
Expand Down Expand Up @@ -319,7 +365,7 @@ gap> DigraphMinimumCut(g, 1, 3);

This attribute is computed by using <Ref Func="DigraphMinimumCut"/>.<P/>

See <Ref Attr="EdgeWeights" Func="EdgeWeightedDigraph"/>.
Comment thread
mtorpey marked this conversation as resolved.
Resolved
See <Ref Attr="EdgeWeights"/>.
<Example><![CDATA[
gap> g := EdgeWeightedDigraph([[2, 2], [3], []], [[3, 2], [1], []]);
<immutable edge-weighted multidigraph with 3 vertices, 3 edges>
Expand Down
2 changes: 2 additions & 0 deletions doc/z-chap5.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
<Section><Heading>Edge Weights</Heading>
<#Include Label="EdgeWeights">
<#Include Label="EdgeWeightedDigraph">
<#Include Label="UnitEdgeWeightedDigraph">
<#Include Label="EdgeWeightedDigraphTotalWeight">
<#Include Label="IsNegativeEdgeWeightedDigraph">
<#Include Label="EdgeWeightedDigraphMinimumSpanningTree">
<#Include Label="EdgeWeightedDigraphShortestPaths">
<#Include Label="EdgeWeightedDigraphShortestPath">
Expand Down
1 change: 1 addition & 0 deletions doc/z-chap6.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ from} $E_a$ \emph{to} $E_b$. In this case we say that $E_a$ and $E_b$ are
<#Include Label="DigraphColouring">
<#Include Label="DigraphGreedyColouring">
<#Include Label="DigraphWelshPowellOrder">
<#Include Label="DigraphSmallestLastOrder">
<#Include Label="ChromaticNumber">
<#Include Label="DigraphCore">
<#Include Label="LatticeDigraphEmbedding">
Expand Down
2 changes: 1 addition & 1 deletion gap/grahom.gd
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ DeclareOperation("DigraphGreedyColouring", [IsDigraph, IsHomogeneousList]);
DeclareOperation("DigraphGreedyColouringNC", [IsDigraph, IsHomogeneousList]);

DeclareAttribute("DigraphWelshPowellOrder", IsDigraph);
DeclareAttribute("DigraphSmallestLastOrder", IsDigraph); # TODO: document
DeclareAttribute("DigraphSmallestLastOrder", IsDigraph);

DeclareOperation("IsDigraphEndomorphism", [IsDigraph, IsTransformation]);
DeclareOperation("IsDigraphHomomorphism",
Expand Down
6 changes: 4 additions & 2 deletions gap/weights.gd
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@

# 1. Edge Weights
DeclareAttribute("EdgeWeights", IsDigraph);
DeclareGlobalFunction("EdgeWeightedDigraph");
DeclareOperation("EdgeWeightedDigraph", [IsDigraph, IsList]);

DeclareOperation("EdgeWeightedDigraph", [IsList, IsList]);
DeclareProperty("IsNegativeEdgeWeightedDigraph", IsDigraph and HasEdgeWeights);
DeclareAttribute("EdgeWeightedDigraphTotalWeight",
IsDigraph and HasEdgeWeights);
DeclareAttribute("UnitEdgeWeightedDigraph", IsDigraph);
DeclareOperation("UnitEdgeWeightedDigraph", [IsDigraph]);

# 2. Edge Weight Copies
DeclareOperation("EdgeWeightsMutableCopy", [IsDigraph and HasEdgeWeights]);
Expand Down
Loading
Loading