graph_vis: graph visualization and community detection

Description Usage Arguments Value Additional arguments Author(s) Examples

View source: R/graph_vis.R

Description

Converts the graph to an igraph object, finds communities and plots it using qgraph package.

Usage

1
2
graph_vis(graph, directed = F, community = T, betweenness = T,
  plot = F, ...)

Arguments

graph

An arbitrary graph object in R.

directed

Set it TRUE when the graph is directed. (default = FALSE)

community

A logical value to show if the node communities should be detected and colored in the returned graph. (default = TRUE)

betweenness

A logical value to show if the node betweenness measurements should be computed and returned from the function. (default = TRUE)

plot

A logical value to show if the graph should be plotted. (default = FALSE)

...

Any additional arguments described below.

Value

If plot = TRUE it plots the non-interactive graph (If plot.community = TRUE plots communities too) also returns a list contains:

graph

an igraph object.

betweenness

betweenness measurements of each node.

network

a visNetwork plot of the graph.

communities

a named vector indicating the community of each node.

Additional arguments

groups

A list that indicates which community each node is. The automatic community detection will be ignored when it is set.

plot.community

Logical indicating if communities should be plotted. Defaults to FALSE.

filename

Name of the plot file without extension. (qgraph function argument)

filetype

A character indicates the file type to save the plots in. (qgraph function argument)

plot.community.list

A list indicates which communities should be plotted. When is not set, will plot all the communities.

Author(s)

Elyas Heidari, Vahid Balazadeh

Examples

1
2
3
4
## Visualize Harman23.cor covariance matrix
require(datasets)
data("Harman23.cor")
gv <- graph_vis(Harman23.cor$cov, plot = TRUE, plot.community = TRUE, plot.community.list = c(1, 2))

bAIo-lab/Questools documentation built on Nov. 9, 2019, 3:59 a.m.