Learn R Programming

mcMST (version 1.1.1)

prueferToEdgeList: Convert Pruefer code to edge list.

Description

Convert Pruefer code to edge list.

Usage

prueferToEdgeList(pcode)

Value

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

Arguments

pcode

[integer] Pruefer code encoding a minimum spanning tree.

See Also

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

Examples

Run this code
# 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)

Run the code above in your browser using DataLab