View source: R/add_edges_raw.R
add_edges_raw | R Documentation |
Adds edges to a graph. Assumes that vertices are numbered 0 and up. Does not recode the source and destination id's of the edges. Does not add vertices when these do not yet exists (this will generate an error; edges are added up until the error).
add_edges_raw( graph_id, edges, edge_src_col = 1, edge_dst_col = 2, edge_weight_col, edge_type_col )
graph_id |
the graph to which to add the edges and vertices. Should
be of type |
edges |
a data.frame withe edges. Should contain at least two columns:
source vertex id's of the edge and destination id's. By default it is assumed
that these are in the first two columns of the data.frame (see |
edge_src_col |
name or number of the column from |
edge_dst_col |
name or number of the column from |
edge_weight_col |
name or number of the column from |
edge_type_col |
name or number of the column from |
Note that the original graph_id
is modified.
Modifies graph_id
and returns graph_id
.
Is intended to be used together with add_vertices_raw
to create a
graph where the user takes care of correctly labelling edges and vertices.
# Create graph with three vertices and 5 edges between them. g <- create_graph() g <- add_vertices_raw(g, data.frame(id = c(0,1,2,3,4))) g <- add_edges_raw(g, data.frame(src = c(0,0,1,1,2), dst = c(1,2,0,2,0))) print(g) delete_graph(g)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.