igraph and data frames
igraph
Section titled “igraph”library(igraph)library(garphieldr)
graph <- make_ring(8, directed = TRUE)V(graph)$group <- rep(c("A", "B"), 4)
project <- garphield_project(graph)garphield(project)
round_trip <- as_igraph(project)Vertex and edge attributes move into the project with direction and graph type
intact. as_igraph() reconstructs the graph from the saved project.
Data frames
Section titled “Data frames”An edge table is enough:
edges <- data.frame( source = c("a", "b"), target = c("b", "c"), weight = c(1.2, 2.4))
project <- garphield_project(edges = edges)Pass a node table when you have node attributes:
nodes <- data.frame(id = c("a", "b", "c"), label = c("A", "B", "C"))project <- garphield_project(edges = edges, nodes = nodes)tables <- as_data_frames(project)Rename the structural columns with the constructor arguments. For parallel
edges, pass edge_key = "key" and multigraph = TRUE.
Character, integer, double, and logical node identities remain distinct across the round trip.