find_ql: Convert index into group pair

Description Usage Arguments Value Examples

View source: R/auxiliary.R

Description

This function is the inverse of the conversion {(q,l), q,l} into {1,...,Q^2} for the directed case {(q,l), q<= l} into {1,...,Q*(Q+1)/2} for the undirected case. It takes the integer index corresponding to (q,l) and returns (q,l).

Usage

1
find_ql(ind_ql, Q, directed = TRUE)

Arguments

ind_ql

Converted (q,l) index

Q

Total number of groups Q

directed

Boolean for directed (TRUE) or undirected (FALSE) case

Value

Group pair (q,l) corresponding to the given index

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Convert the index 5 into a group pair for undirected graph
# and the index 8 into a group pair for directed graph
# where the total number of group is 3

ind_ql_dir <- 8
ind_ql_undir <- 5

Q <- 3

directedIndex <- find_ql(ind_ql_dir,Q)
undirectedIndex <- find_ql(ind_ql_undir,Q, FALSE)

ppsbm documentation built on May 1, 2019, 11:26 p.m.