The network L
should be a tree, that is, it must have no loops.
This function computes a character string label for each vertex
of the network L
. The vertex identified by root
(that is, vertices(L)[root]
) is taken as the root of the tree
and is given the empty label ""
.
If there are several line
segments which meet at the root vertex, each of these segments is the
start of a new branch of the tree; the other endpoints of these
segments are assigned the labels
"a"
, "b"
, "c"
and so on.
If only one segment issues from the root vertex,
the other endpoint of this segment is assigned the empty label
""
.
A similar rule is then applied to each of the newly-labelled vertices.
If the vertex labelled "a"
is joined to two other unlabelled
vertices, these will be labelled "aa"
and "ab"
.
The rule is applied recursively until all vertices have been labelled.
If L
is not a tree, the algorithm will terminate, but the
results will be nonsense.