edgeListToCharVec: Convert edge list to characteristic vector.

View source: R/transformations.R

edgeListToCharVecR Documentation

Convert edge list to characteristic vector.

Description

Convert edge list to characteristic vector.

Usage

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

# 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/mcMST documentation built on March 14, 2023, 4:28 p.m.