permutationToEdgelist: Convert permutation to edge list.

View source: R/transformations.R

permutationToEdgelistR 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)

mcMST documentation built on April 1, 2023, 12:19 a.m.