makeGraph: Simple function to create and measure a graph from a square...

Description Usage Arguments Value Author(s) Examples

View source: R/makeGraph.R

Description

Creates an igraph object from a square input correlation matrix - only positive correlations are used. Based on the graph.adjacency function of igraph. gplot is helpful for visualization.

Usage

1
2
3
4
5
6
7
makeGraph(
  mat,
  graphdensity = 1,
  communityMethod = NA,
  getEfficiency = FALSE,
  inverseValuesAsWeights = FALSE
)

Arguments

mat

input matrix

graphdensity

fraction of edges to keep

communityMethod

see igraph's community detection

getEfficiency

boolean, this is slow to compute

inverseValuesAsWeights

if TRUE, high correlations produce small edge weights. This detail is important when using igraph algorithms as different methods use weights in different ways. See igraph for its is_weighted documentation which notes that weights are used as distances in shortest path calculations and as strength (similar to degree) for community methods.

Value

a named list is output including the graph object, adjacency matrix and several graph metrics

Author(s)

Avants BB

Examples

1
2
3
4
5
mat <- matrix(c(rep(1,100)),ncol=10)
gobj<-makeGraph( mat )
mat <- matrix(  c( 1, 0.5, 0.2, -0.1, 1, 0.3, -0.2, 0.6, 1 ) , ncol= 3 )
gobj<-makeGraph( mat , 0.5 )
# gplot( gobj$adjacencyMatrix ) # need sna library for this

neuroconductor-devel/ANTsR documentation built on April 1, 2021, 1:02 p.m.