Learn R Programming

mcMST (version 1.0.1)

prueferToCharVec: Convert Pruefer code to characteristic vector.

Description

Convert Pruefer code to characteristic vector.

Usage

prueferToCharVec(pcode)

Value

[integer] Characteristic vector cv with cv[i] = 1 if the i-th edge is in the tree.

Arguments

pcode

[integer] Pruefer code encoding a minimum spanning tree.

See Also

Other transformation functions: edgeListToCharVec, permutationToCharVec, permutationToEdgelist, prueferToEdgeList

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)
print(prueferToCharVec(pcode))

Run the code above in your browser using DataLab