as_edgelist: Convert a graph to an edge list

Description Usage Arguments Details Value See Also Examples

View source: R/conversion.R

Description

Sometimes it is useful to work with a standard representation of a graph, like an edge list.

Usage

1

Arguments

graph

The graph to convert.

names

Whether to return a character matrix containing vertex names (ie. the name vertex attribute) if they exist or numeric vertex ids.

Details

as_edgelist returns the list of edges in a graph.

Value

A gsize(graph) by 2 numeric matrix.

See Also

graph_from_adjacency_matrix, read_graph

Examples

1
2
3
4
5
g <- sample_gnp(10, 2/10)
as_edgelist(g)

V(g)$name <- LETTERS[seq_len(gorder(g))]
as_edgelist(g)

igraph documentation built on March 19, 2020, 5:13 p.m.

Related to as_edgelist in igraph...