graph()
was renamed to make_graph()
to create a more
consistent API.
Usage
graph(
edges,
...,
n = max(edges),
isolates = NULL,
directed = TRUE,
dir = directed,
simplify = TRUE
)
Arguments
- edges
A vector defining the edges, the first edge points from the first element to the second, the second edge from the third to the fourth, etc. For a numeric vector, these are interpreted as internal vertex ids. For character vectors, they are interpreted as vertex names.
Alternatively, this can be a character scalar, the name of a notable graph. See Notable graphs below. The name is case insensitive.
Starting from igraph 0.8.0, you can also include literals here, via igraph's formula notation (see
graph_from_literal()
). In this case, the first term of the formula has to start with a ‘~
’ character, just like regular formulae in R. See examples below.- ...
For
make_graph()
: extra arguments for the case when the graph is given via a literal, seegraph_from_literal()
. Fordirected_graph()
andundirected_graph()
: Passed tomake_directed_graph()
ormake_undirected_graph()
.- n
The number of vertices in the graph. This argument is ignored (with a warning) if
edges
are symbolic vertex names. It is also ignored if there is a bigger vertex id inedges
. This means that for this function it is safe to supply zero here if the vertex with the largest id is not an isolate.- isolates
Character vector, names of isolate vertices, for symbolic edge lists. It is ignored for numeric edge lists.
- directed
Whether to create a directed graph.
- dir
It is the same as
directed
, for compatibility. Do not give both of them.- simplify
For graph literals, whether to simplify the graph.