permutationToEdgelist {mcMST}R Documentation

Convert permutation to edge list.

Description

Convert permutation to edge list.

Usage

permutationToEdgelist(perm)

Arguments

perm

[integer]
Permutation of nodes, e.g., solution of a TSP.

Value

[matrix(2, length(perm))] Edge list.

See Also

Other transformation functions: charVecToEdgelist(), edgeListToCharVec(), nodelistToEdgelist(), permutationToCharVec(), prueferToCharVec(), prueferToEdgeList()

Examples

# 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
permutationToEdgelist(perm)

[Package mcMST version 1.1.1 Index]