Create a graph from an edge list matrix
graph_from_edgelist creates a graph from an edge list. Its argument
is a two-column matrix, each row defines one edge. If it is
a numeric matrix then its elements are interpreted as vertex ids. If
it is a character matrix then it is interpreted as symbolic vertex
names and a vertex id will be assigned to each name, and also a
name vertex attribute will be added.
graph_from_edgelist(el, directed = TRUE)
- The edge list, a two column matrix, character or numeric.
- Whether to create a directed graph.
- Passed to
- An igraph graph.
Other determimistic constructors:
el <- matrix( c("foo", "bar", "bar", "foobar"), nc = 2, byrow = TRUE) graph_from_edgelist(el) # Create a ring by hand graph_from_edgelist(cbind(1:10, c(2:10, 1)))