[Next] [Prev] [Right] [Left] [Up] [Index] [Root]
Labelled Graphs

Labelled Graphs

A vertex labelling of a graph G is a partial map f from the vertex-set V of G into a set L. The set L is known as the vertex label set. An edge labelling of a graph G is a partial map f from the edge-set E of G into a set L. The set L is known as the edge label set. A labelled graph is built by assigning labels successively to vertices or edges after the (unlabelled) graph has been constructed.

For the following operations, T may be interpreted as either the vertex-set or edge-set of some graph. The variable t may be interpreted as either a vertex or an edge.

Subsections

Labelling a Graph

AssignLabel(t, l) : GrphVert, . ->
AssignLabel(t, l) : GrphEdge, . ->
Assigns the label l to the edge or vertex t
AssignLabel(G, i, l) : Grph, RngIntElt, . ->
Assign the label l to the ith vertex of G.
AssignLabel(G, i, j, l) : Grph, RngIntElt, RngIntElt, . ->
Assign the label l to the edge between the ith and jth vertices of G.
AssignLabels(S, L) : [GrphVert], SeqEnum ->
AssignLabels(S, L) : {@ GrphVert @}, SeqEnum ->
AssignLabels(S, L) : [GrphEdge], SeqEnum ->
AssignLabels(S, L) : {@ GrphEdge @}, SeqEnum ->
Assigns the labels in L to the corresponding edges or vertices in the sequence or indexed set S. If for some edge or vertex t the corresponding entry in L is not defined then any existing label of t is removed.
AssignLabels(G, S, L) : Grph, [RngIntElt], SeqEnum ->
Assign the labels in L to the vertices of G whose indices are the corresponding elements in S. If for some vertex v whose index is in S the corresponding label in L is not defined then any existing label of v is removed.
AssignLabels(G, S, L) : Grph, SeqEnum, SeqEnum ->
Assign the labels in L to the edges of G specified in S. The elements of S must be sets or sequences of two integers, depending on whether G is undirected or directed respectively. Each element of S will correspond to the edge between the ith and jth vertices of G, where i and j are the two integers in the element.
AssignLabels(T, L) : GrphVertSet, SeqEnum ->
AssignLabels(T, L) : GrphEdgeSet, SeqEnum ->
Assigns the labels in L to the corresponding edges or vertices in T If for some edge or vertex t the corresponding entry in L is not defined then any existing label of t is removed.

Reading Labels

Label(t) : GrphVert -> .
Label(t) : GrphEdge -> .
The label of the edge or vertex t. It is an error if t does not have a label defined.
VertexLabel(G, i) : Grph, RngIntElt -> .
The label of the ith vertex of G. It is an error if the vertex does not have a label defined.
EdgeLabel(G, i, j) : Grph, RngIntElt, RngIntElt -> .
The label of the edge between the ith and jth vertices of G. It is an error if the edge does not have a label defined.
Labels(S) : [GrphVert] -> SeqEnum
Labels(S) : [GrphEdge] -> SeqEnum
The sequence L of labels of the edges or vertices in S. If an element of S has no label, then the corresponding entry in L is undefined.
Labels(T) : GrphVertSet -> SeqEnum
Labels(T) : GrphEdgeSet -> SeqEnum
The sequence L of labels of the edges or vertices in T. If an element of T has no label, then the corresponding entry in L is undefined.
VertexLabels(G, S) : Grph, [RngIntElt] -> SeqEnum
The sequence L of labels of the vertices of G whose indices are in S. If a vertex whose index is in S has no label, then the corresponding entry in L is undefined.
VertexLabels(G) : Grph -> SeqEnum
The sequence L of labels of the vertices of G. If a vertex of G has no label, then the corresponding entry in L is undefined.
EdgeLabels(G, S) : Grph, SeqEnum -> SeqEnum
The sequence L of labels of the edges of G specified in S. The elements of S must be sets or sequences of two integers, depending on whether G is undirected or directed respectively. Each element of S will correspond to the edge between the ith and jth vertices of G, where i and j are the two integers in the element. If the edge has no label, then the corresponding element of L is undefined.
EdgeLabels(G) : Grph -> SeqEnum
The sequence L of labels of the edges of G. If an edge of G has no label, then the corresponding entry in L is undefined.

Testing for Labels

IsLabelled(t) : GrphVert -> BoolElt
IsLabelled(t) : GrphEdge -> BoolElt
True if and only if the edge or vertex t has a label.
IsLabelledVertex(G, i) : Grph, RngIntElt -> BoolElt
True if and only if the i-th vertex of G has a label.
IsLabelledEdge(G, i, j) : Grph, RngIntElt, RngIntElt -> BoolElt
True if and only if the edge between the ith and jth vertices of G has a label.

Deleting Labels

DeleteLabel(t) : GrphVert ->
DeleteLabel(t) : GrphEdge ->
Removes the label of the edge or vertex t.
DeleteLabel(G, i) : Grph, RngIntElt ->
Removes the label of the ith vertex of G.
DeleteLabel(G, i, j) : Grph, RngIntElt, RngIntElt ->
Remove the label of the edge between the ith and jth vertices of G.
DeleteLabels(S) : [GrphVert] ->
DeleteLabels(S) : [GrphEdge] ->
Remove the labels of the edges or vertices in S.
DeleteLabels(G, S) : Grph, [RngIntElt] ->
Remove the labels of the vertices of G whose indices are in S.
DeleteLabels(G, S) : Grph, SeqEnum ->
Remove the labels of the edges of G specified in S. The elements of S must be sets or sequences of two integers, depending on whether G is undirected or directed respectively. Each element of S will correspond to the edge between the ith and jth vertices of G, where i and j are the two integers in the element.
DeleteLabels(T) : GrphVertSet ->
DeleteLabels(T) : GrphEdgeSet ->
Remove the labels of the edges or vertices in T.

Example Graph_Labels (H55E7)

The labelling operations are illustrated by constructing a 2-colouring of the complete bipartite graph K_(3, 4). Use is made of the function Distance(u, v) which returns the distance between vertices u and v.

> K34, V, E := BipartiteGraph(3, 4);
> L := [ IsEven(Distance(V!1, v)) select "red" else "blue" : >                                        v in Vertices(K34) ];
> AssignLabels(Vertices(K34), L);
> VertexLabels(K34);                                          
[ red, red, red, blue, blue, blue, blue ]

Example Graph_CayleyGraph (H55E8)

Another illustration is the creation of the Cayley graph of a group. In this example Sym(4) is used.

> G<a,b> := FPGroup(Sym(4));
> I,m := Transversal(G, sub<G | 1>);
> S := Setseq(Generators(G));
> N := [{m(a*b) : b in S} : a in I];      
> graph := StandardGraph(Digraph<I | N>);
> AssignLabels(VertexSet(graph), IndexedSetToSequence(I));
> for i in [1..#I] do
>     AddEdges( graph, [[i, Index(I, m(I[i]*s))] : s in S], S);
> end for;
In this graph, [1,2,5,4] is a cycle. So the corresponding edge labels should multiply to the identity.

> &*EdgeLabels(graph, [[1,2],[2,5],[5,4],[4,1]]);
a^4
> G;
Finitely presented group G on 2 generators
Relations
    b^2 = Id(G)
    a^4 = Id(G)
    (a^-1 * b)^3 = Id(G)

[Next] [Prev] [Right] [Left] [Up] [Index] [Root]