View source: R/transformations.R
permutationToCharVec | R Documentation |
Convert permutation to characteristic vector.
permutationToCharVec(perm, n)
perm |
[ |
n |
[ |
[integer
] Characteristic vector cv with cv[i] = 1 if the i-th edge is in the tree.
Other transformation functions:
charVecToEdgelist()
,
edgeListToCharVec()
,
nodelistToEdgelist()
,
permutationToEdgelist()
,
prueferToCharVec()
,
prueferToEdgeList()
# first generate a random permutation, e.g., representing
# a roundtrip tour in a graph
perm = sample(1:10)
print(perm)
# now convert into an edge list
permutationToCharVec(perm, n = 10)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.