edgeListToCharVec: Convert edge list to characteristic vector.

Description Usage Arguments Value See Also Examples

View source: R/transformations.R

Description

Convert edge list to characteristic vector.

Usage

1
edgeListToCharVec(edgelist, n = NULL)

Arguments

edgelist

[matrix(2, k)] Matrix of edges (each column is one edge).

n

[integer]
Number of nodes of the problem.

Value

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

See Also

Other transformation functions: charVecToEdgelist, nodelistToEdgelist, permutationToCharVec, permutationToEdgelist, prueferToCharVec, prueferToEdgeList

Examples

1
2
3
4
5
6
7
8
# 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)

jakobbossek/rmoco documentation built on May 10, 2018, 9:53 p.m.