View source: R/transformations.R
| edgeListToCharVec | R Documentation |
Convert edge list to characteristic vector.
edgeListToCharVec(edgelist, n = NULL)
edgelist |
[ |
n |
[ |
[integer] Characteristic vector cv with cv[i] = 1 if the i-th edge is in the tree.
Other transformation functions:
charVecToEdgelist(),
nodelistToEdgelist(),
permutationToCharVec(),
permutationToEdgelist(),
prueferToCharVec(),
prueferToEdgeList()
# first we generate a small edge list by hand
# (assume the given graph has n = 4 nodes)
edgelist = matrix(c(1, 2, 2, 4, 3, 4), ncol = 3)
print(edgelist)
# next we transform the edge into
# a characteristic vector
cvec = edgeListToCharVec(edgelist, n = 4)
print(cvec)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.