prueferToEdgeList {mcMST}R Documentation

Convert Pruefer code to edge list.

Description

Convert Pruefer code to edge list.

Usage

prueferToEdgeList(pcode)

Arguments

pcode

[integer] Pruefer code encoding a minimum spanning tree.

Value

[matrix(2, length(pcode) + 1)] Edge list.

See Also

Other transformation functions: charVecToEdgelist(), edgeListToCharVec(), nodelistToEdgelist(), permutationToCharVec(), permutationToEdgelist(), prueferToCharVec()

Examples

# here we generate a random Pruefer-code representing
# a random spanning tree of a graph with n = 10 nodes
pcode = sample(1:10, 8, replace = TRUE)
print(pcode)
edgelist = prueferToEdgeList(pcode)
print(edgelist)

[Package mcMST version 1.1.1 Index]