These are light-weight wrappers around 'tidygraph' functions to create random graphs. They return graphs with named nodes.

quick_forestfire(n, name = c(), directed = FALSE)

quick_barabasi(n, name = c(), directed = FALSE)

quick_graph(n, name = c(), directed = FALSE)

Arguments

n

number of nodes

name

node names; default is LETTERS

directed

boolean value for directed or undirected graph

Value

a tridygraph object with named nodes

Examples

set.seed(0) forest_gr <- quick_forestfire(20) forest_gr
#> # A tbl_graph: 20 nodes and 71 edges #> # #> # An undirected simple graph with 1 component #> # #> # Node Data: 20 x 1 (active) #> name #> <chr> #> 1 A #> 2 B #> 3 C #> 4 D #> 5 E #> 6 F #> # … with 14 more rows #> # #> # Edge Data: 71 x 2 #> from to #> <int> <int> #> 1 1 2 #> 2 1 3 #> 3 2 3 #> # … with 68 more rows
plot(forest_gr)
barabasi_gr <- quick_barabasi(20) barabasi_gr
#> # A tbl_graph: 20 nodes and 19 edges #> # #> # An undirected simple graph with 1 component #> # #> # Node Data: 20 x 1 (active) #> name #> <chr> #> 1 A #> 2 B #> 3 C #> 4 D #> 5 E #> 6 F #> # … with 14 more rows #> # #> # Edge Data: 19 x 2 #> from to #> <int> <int> #> 1 1 2 #> 2 1 3 #> 3 1 4 #> # … with 16 more rows
plot(barabasi_gr)