powered by
Sometimes it is useful to work with a standard representation of a graph, like an edge list.
as_edgelist(graph, names = TRUE)
The graph to convert.
Whether to return a character matrix containing vertex names (ie. the name vertex attribute) if they exist or numeric vertex ids.
name
A gsize(graph) by 2 numeric matrix.
gsize(graph)
as_edgelist returns the list of edges in a graph.
as_edgelist
graph_from_adjacency_matrix, read_graph
graph_from_adjacency_matrix
read_graph
# NOT RUN { g <- sample_gnp(10, 2/10) as_edgelist(g) V(g)$name <- LETTERS[seq_len(gorder(g))] as_edgelist(g) # }
Run the code above in your browser using DataLab