prueferToEdgeList: Convert Pruefer code to edge list.

View source: R/transformations.R

prueferToEdgeListR 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)

jakobbossek/mcMST documentation built on March 14, 2023, 4:28 p.m.