graph_centrality: Graph the network with centrality score

Description Usage Arguments Value Examples

View source: R/graph_centrality.R

Description

graph_centrality graphs the network (as a graph object) overlapped with the specified centrality score. This function only performs the graphing and not any computation

Usage

1
2
3
4
5
6
7
graph_centrality(
  graph,
  centr_score,
  main = "Centrality Network",
  seed = 1,
  legend = T
)

Arguments

graph

A graph object as defined in the igraph package

centr_score

A length-n vector of pre-calculated centrality score for each node

main

A custom string. Title of the plot.

seed

A seed value that can be custom specified. Default is 1.

legend

A boolean specifying if we want to display the legend or not

Value

Function has no return value. It makes a cute plot though.

Examples

1
2
3
4
5
A.mat = sim_adjacency(10, mode = "undirected")  # symmetric; all edge weights 1
A.graph = igraph::graph_from_adjacency_matrix(A.mat, mode = "undirected")
c.deg.und = degree(A.mat, type = "undirected")  # calculate centrality score

graph_centrality(A.graph, c.deg.und, main = "Degree Centrality (undirected)")

lwa19/centrality documentation built on Dec. 21, 2021, 12:45 p.m.