This function creates a network from a vector of explicitly named nodes and ties between them. create_explicit() largely wraps igraph::graph_from_literal(), but will also accept character input and not just a formula, and will never simplify the result.

Ties are indicated by -, and directed ties (arcs) require + at either or both ends. Ties are separated by commas, and isolates can be added as an additional, unlinked node after the comma within the formula. Sets of nodes can be linked to other sets of nodes through use of a semi-colon. See the example for a demonstration.

create_explicit(...)

Arguments

...

Arguments passed on to {igraph}.

Examples

  create_explicit(A -+ B, B -+ C, A +-+ C, D, E:F:G-+A, E:F+-+G:H)
#> # A labelled, directed network of 8 nodes and 15 arcs
#> # A tibble: 8 × 1
#>   name 
#>   <chr>
#> 1 A    
#> 2 B    
#> 3 C    
#> 4 D    
#> 5 E    
#> 6 F    
#> # ℹ 2 more rows
#> # A tibble: 15 × 2
#>    from    to
#>   <int> <int>
#> 1     1     2
#> 2     2     3
#> 3     3     1
#> 4     1     3
#> 5     5     1
#> 6     6     1
#> # ℹ 9 more rows