prueferToCharVec: Convert Pruefer code to characteristic vector.

View source: R/transformations.R

prueferToCharVecR Documentation

Convert Pruefer code to characteristic vector.

Description

Convert Pruefer code to characteristic vector.

Usage

prueferToCharVec(pcode)

Arguments

pcode

[integer] Pruefer code encoding a minimum spanning tree.

Value

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

See Also

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

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

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