This is a generic function for creating graphs.
Details
make_()
is a generic function for creating graphs.
For every graph constructor in igraph that has a make_
prefix,
there is a corresponding function without the prefix: e.g.
for make_ring()
there is also ring()
, etc.
The same is true for the random graph samplers, i.e. for each
constructor with a sample_
prefix, there is a corresponding
function without that prefix.
These shorter forms can be used together with make_()
.
The advantage of this form is that the user can specify constructor
modifiers which work with all constructors. E.g. the
with_vertex_()
modifier adds vertex attributes
to the newly created graphs.
See the examples and the various constructor modifiers below.
See also
Other deterministic constructors:
graph_from_atlas()
,
graph_from_edgelist()
,
graph_from_literal()
,
make_chordal_ring()
,
make_empty_graph()
,
make_full_citation_graph()
,
make_full_graph()
,
make_graph()
,
make_lattice()
,
make_ring()
,
make_star()
,
make_tree()
Constructor modifiers (and related functions)
sample_()
,
simplified()
,
with_edge_()
,
with_graph_()
,
with_vertex_()
,
without_attr()
,
without_loops()
,
without_multiples()
Examples
r <- make_(ring(10))
l <- make_(lattice(c(3, 3, 3)))
r2 <- make_(ring(10), with_vertex_(color = "red", name = LETTERS[1:10]))
l2 <- make_(lattice(c(3, 3, 3)), with_edge_(weight = 2))
ran <- sample_(degseq(c(3, 3, 3, 3, 3, 3), method = "configuration"), simplified())
degree(ran)
#> [1] 3 3 3 1 3 3
is_simple(ran)
#> [1] TRUE