Learn R Programming

brainGraph (version 2.7.3)

RandomGraphs: Perform an analysis with random graphs for brain MRI data

Description

analysis_random_graphs is not quite a "proper" function. It performs the steps needed for doing typical graph theory analyses with brain MRI data if you need to generate equivalent random graphs. This includes calculating small world parameters and normalized rich club coefficients.

sim.rand.graph.par simulates N simple random graphs with the same clustering (optional) and degree sequence as the input. Essentially a wrapper for sample_degseq (or, if you want to match by clustering, sim.rand.graph.clust) and set_brainGraph_attr. It uses foreach for parallel processing.

sim.rand.graph.clust simulates a random graph with a given degree sequence and clustering coefficient. Increasing the max.iters value will result in a closer match of clustering with the observed graph.

Usage

analysis_random_graphs(g.list, N = 100, savedir = ".", ...)

sim.rand.graph.par(g, N = 100, clustering = FALSE, ...)

sim.rand.graph.clust(g, rewire.iters = 10000, cl = g$transitivity, max.iters = 100)

Arguments

g.list

List of lists containing igraph graph objects

N

Integer; the number of random graphs to simulate (default: 100)

savedir

Character string specifying the directory in which to save the generated graphs (default: current working directory)

...

Other parameters (passed to sim.rand.graph.clust)

g

An igraph graph object

clustering

Logical; whether or not to control for clustering (default: FALSE)

rewire.iters

Integer; number of rewiring iterations for the initial graph randomization (default: 1e4)

cl

The clustering measure (default: transitivity)

max.iters

The maximum number of iterations to perform; choosing a lower number may result in clustering that is further away from the observed graph's (default: 100)

Value

analysis_random_graphs returns a list containing:

rich

A data table containing normalized rich-club coefficients and p-values

small

A data table with small-world parameters

rand

A data table with some global graph measures for all random graphs generated

sim.rand.graph.par - a list of N random graphs with some additional vertex and graph attributes

sim.rand.graph.clust - A single igraph graph object

Details

analysis_random_graphs does the following:

  1. Generate N random graphs for each group and density/threshold (and subject if you have subject-specific graphs).

  2. Write graphs to disk in savedir. Read them back into R and combine into lists; then write these lists to disk (in a sub-directory named ALL), so you can delete the individual .rds files afterwards.

  3. Calculate small world parameters, along with values for a few global graph measures that may be of interest.

  4. Calculate normalized rich club coefficients and associated p-values.

If you do not want to match by clustering, then simple rewiring of the input graph is performed (the number of rewire's equaling the larger of 1e4 and \(10 \times m\), where \(m\) is the graph's edge count).

References

Bansal S., Khandelwal S., Meyers L.A. (2009) Exploring biological network structure with clustered random networks. BMC Bioinformatics, 10:405-421.

See Also

small.world

rewire, sample_degseq, keeping_degseq

transitivity

Other Random graph functions: RichClub

Examples

Run this code
# NOT RUN {
rand_all <- analysis_random_graphs(g.norm, 1e2,
  savedir='/home/cwatson/dti/rand', clustering=F)
# }
# NOT RUN {
rand1 <- sim.rand.graph.par(g[[1]][[N]], N=1e3)
rand1.cl <- sim.rand.graph.par(g[[1]][[N]], N=1e2,
  clustering=T, max.iters=1e3)
# }

Run the code above in your browser using DataLab