View source: R/transformations.R
prueferToCharVec | R Documentation |
Convert Pruefer code to characteristic vector.
prueferToCharVec(pcode)
pcode |
[ |
[integer
] Characteristic vector cv with cv[i] = 1 if the i-th edge is in the tree.
Other transformation functions:
charVecToEdgelist()
,
edgeListToCharVec()
,
nodelistToEdgelist()
,
permutationToCharVec()
,
permutationToEdgelist()
,
prueferToEdgeList()
# 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))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.