Description Usage Arguments Details Value Examples
Convert node pair (i,j) into an index
The node pair (i,j) with (i\neq j) is converted into the index (i-1)*(n-1)+j-(i<j)
The node pair (i,j) with (i\neq j) is converted into the index (2*n-i)*(i-1)/2 +j-i
1 | convertNodePair(i, j, n, directed)
|
i |
Node i : i\in {1, …, n} |
j |
Node j : j\in {1, …, n} |
n |
Total number of nodes : i,j\in {1, …, n} |
directed |
Boolean for directed (TRUE) or undirected (FALSE) case |
The number of possible node pairs is
N = n*(n-1) for the directed case
N = n*(n-1)/2 for the undirected case
which corresponds to the cardinality of data$type.seq
Index corresponding to the node pair
1 2 3 4 5 6 7 8 9 | # Convert the node pair (3,7) into an index, where the total number of nodes is 10,
# for directed and undirected graph
i <- 3
j <- 7
n <- 10
directedIndex <- convertNodePair(i,j,n,TRUE)
undirectedIndex <- convertNodePair(i,j,n,FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.