graph_attr_from_df {smallstuff}R Documentation

Add Graph Attributes to a Graph from a Data Frame

Description

Add graph attributes to a graph from a data frame where each column represents an attribute. Note that only the first row of the data frame is used.

Usage

graph_attr_from_df(g, df)

Arguments

g

the graph (an igraph object) to which the graph attributes should be added

df

data frame, or an object that can be converted to a data frame, where the first row contains a graph attribute in each column

Value

Graph g with the graph attributes in df added.

Examples

g=igraph::graph_from_literal(1-2,2-3:4,3-4:5:6,5-1)
df=data.frame(name="Test Graph",descr="A graph")
graph_attr_from_df(g,df)

[Package smallstuff version 1.0.3 Index]