add_igraph_info {sgraph} | R Documentation |
Add nodes information to the igraph object
Description
Modify the node attributes of an existing igraph object by providing a dataframe
Usage
add_igraph_info(igraph, df_nodes, fields = names(df_nodes))
Arguments
igraph |
Igraph object to modify |
df_nodes |
Data frame to add to nodes |
fields |
Columns of df_nodes to add. First must be the node identifier. |
Value
A sgraph object with modified node labels
Examples
library(igraph)
library(sgraph)
data(lesMis)
df_nodes = cbind.data.frame(name = igraph::vertex_attr(lesMis, 'label'),
log10_degree = degree(lesMis))
igraph = add_igraph_info(lesMis, df_nodes)
sig <- sigma_from_igraph(lesMis) %>%
add_node_size(size_vector = 'log10_degree')
[Package sgraph version 1.0.0 Index]