
Last chance! 50% off unlimited learning
Sale ends in
To create small graphs with a given structure probably the
graph.formula
function is easiest. It uses R's formula
interface, its manual page contains many examples. Another option is
graph
, which takes numeric vertex ids directly.
graph.atlas
creates graph from the Graph Atlas,
graph.famous
can create some special graphs.
To create graphs from field data, graph.edgelist
,
graph.data.frame
and graph.adjacency
are
probably the best choices.
The igraph include some classic random graphs like the Erdos-Renyi GNP
and GNM graphs (erdos.renyi.game
) and some recent
popular models, like preferential attachment
(barabasi.game
) and the small-world model
(watts.strogatz.game
).
subgraph
, then
the vertices are renumbered to satisfty this criteria. The same is true for the edges as well, edge ids are always between
zero and
It is often desirable to follow vertices along a number of graph operations, and vertex ids don't allow this because of the renumbering. The solution is to assign attributes to the vertices. These are kept by all operations, if possible. See more about attributes in the next section.
get.vertex.attribute
and
iterators
for details. Some vertex/edge/graph attributes are treated specially. One of them
is the igraph.plotting
for
details.
Attribute values can be set to any R object, but note that storing the
graph in some file formats might result the loss of complex attribute
values. All attribute values are preserved if you use
save
and load
to store/retrieve your
graphs.
plot.igraph
plot.igraph
plot
The second function is tkplot
, which uses a Tk GUI for
basic interactive graph manipulation. (Tk is quite resource hungry, so
don't try this for very large graphs.)
The third way requires the rgl
package and uses OpenGL. See the
rglplot
function for the details.
Make sure you read igraph.plotting
before you start
plotting your graphs.
read.graph
and
write.graph
for details.