graph_attr_from_df: Add Graph Attributes to a Graph from a Data Frame

View source: R/graphs.R

graph_attr_from_dfR 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)

smallstuff documentation built on June 2, 2022, 5:06 p.m.