Standard labeling of edges with integers
Standard labeling of edges with integers
Functions to convert between fromto representation and standard labeling of the edges for undirected graphs with no selfloops.
 Keywords
 graphs
Usage
ftM2int(ft)
int2ftM(i)
Arguments
 i
 Numeric vector.
 ft
 Numeric nx2 or 2xn matrix.
Details
A standard 1based node labeling of a graph G=(V,E) is a onetoone mapping between the integers from 1 to V and the nodes in V. A standard 1based edge labeling of an undirected graph G=(V,E) with no selfloops is the onetoone mapping between the integers from 1 to V choose 2 = V*(V1)/2 such that the edge labeled 1 is between nodes 2 and 1, the edge labeled 2 is between nodes 3 and 1, the edge labeled 3 is between nodes 3 and 2, and so on.
Value

For
ftM2int
, a numeric vector of length n.
For int2ftM
, a length(i) x 2
matrix.
Examples
nNodes < 200
nEdges < choose(nNodes, 2)
i < 1:nEdges
ft < int2ftM(i)
ft[1:6,]
stopifnot(all(ft[,1]>ft[,2])) ## always from higher to lower
stopifnot(!any(duplicated(paste(ft[,1], ft[,2]))))
stopifnot(ft[nEdges, 1]==nNodes, ft[nEdges, 2]==nNodes1)
j < ftM2int(ft)
stopifnot(all(i==j))
Community examples
Looks like there are no examples yet.