"random"
, "hub"
, "cluster"
, "band"
, and "scale-free"
.
sugm.generator(n = 200, d = 50, graph = "random", v = NULL, u = NULL, g = NULL, prob = NULL, seed = NULL, vis = FALSE, verbose = TRUE)
"hub"
and "cluster"
, d
$ \ge $4 is required. For "random"
, "band"
and "scale-free"
, d
$ \ge $3 is required. The default value is $50$.
"random"
, "hub"
, "cluster"
, "band"
, and "scale-free"
.
u
. The default value is 0.3.
"cluster"
or "hub"
graph, g
is the number of hubs or clusters in the graph. The default value is about d
/20 if d
$ \ge$ 40 and 2 if d
$ <$ 40.="" for="" "band" graph, g
is the bandwidth and the default value is $1$. NOT applicable to "random"
graph.
$>
"random"
graph, it is the probability that a pair of nodes has an edge. The default value is 3/d
. For "cluster"
graph, it is the probability that a pair of nodes has an edge in each cluster. The default value is 6$*$g/d
if d/g
$ \le$ 30 and 0.3 if d/g
$ >$ 30. NOT applicable to "hub"
, "band"
, and "scale-free"
graphs.
FALSE
.
verbose = FALSE
, tracing information printing is disabled. The default value is TRUE
.
n
by d
matrix for the generated data
theta
, the graph patterns are generated as below:
(I) "random"
: Each pair of off-diagonal elements are randomly set theta[i,j]=theta[j,i]=1
for i!=j
with probability prob
, and 0
other wise. It results in about d*(d-1)*prob/2
edges in the graph.
(II)"hub"
:The row/columns are evenly partitioned into g
disjoint groups. Each group is associated with a "center" row i
in that group. Each pair of off-diagonal elements are set theta[i,j]=theta[j,i]=1
for i!=j
if j
also belongs to the same group as i
and 0
otherwise. It results in d - g
edges in the graph.
(III)"cluster"
:The row/columns are evenly partitioned into g
disjoint groups. Each pair of off-diagonal elements are set theta[i,j]=theta[j,i]=1
for i!=j
with the probability prob
if both i
and j
belong to the same group, and 0
other wise. It results in about g*(d/g)*(d/g-1)*prob/2
edges in the graph.
(IV)"band"
: The off-diagonal elements are set to be theta[i,j]=1
if 1<=|i-j|<=g< code=""> and 0
other wise. It results in (2d-1-g)*g/2
edges in the graph.
(V) "scale-free"
: The graph is generated using B-A algorithm. The initial graph has two connected nodes and each new node is connected to only one node in the existing graph with the probability proportional to the degree of the each node in the existing graph. It results in d
edges in the graph.The adjacency matrix theta
has all diagonal elements equal to 0
. To obtain a positive definite covariance matrix, the smallest eigenvalue of theta*v
(denoted by e
) is computed. Then we set the covariance matrix equal to cov2cor(solve(theta*v+(|e|+0.1+u)*I))
to generate multivariate normal data.
=|i-j|<=g<>
flare
and flare-package
## load package required
library(flare)
## band graph with bandwidth 3
L = sugm.generator(graph = "band", g = 3)
plot(L)
## random sparse graph
L = sugm.generator(vis = TRUE)
## random dense graph
L = sugm.generator(prob = 0.5, vis = TRUE)
## hub graph with 6 hubs
L = sugm.generator(graph = "hub", g = 6, vis = TRUE)
## cluster graph with 8 clusters
L = sugm.generator(graph = "cluster", g = 8, vis = TRUE)
## scale-free graphs
L = sugm.generator(graph="scale-free", vis = TRUE)
Run the code above in your browser using DataLab