Skip to contents

These functions take a vector of 'digraph6' symbols and return a list of other types of objects:

  • adjacency_from_digraph6() creates adjacency matrices

  • igraph_from_digraph6() creates 'igraph' objects. Requires package igraph to be installed.

  • network_from_digraph6() creates 'network' objects. Requires package network to be installed.

Usage

adjacency_from_digraph6(d6)

igraph_from_digraph6(d6, ...)

network_from_digraph6(d6, ...)

Arguments

d6

character vector of 'digraph6' symbols

...

other arguments, see Details.

Value

The returned object is:

  • for adjacency_from_digraph6(), a list of the same length as its input of square symmetric adjacency matrices.

  • for igraph_from_digraph6(), a list of 'igraph' objects

  • for network_from_digraph6(), a list of 'network' objects

Details

For igraph_from_digraph6() additional arguments are passed to igraph::graph_from_adjacency_matrix()

For network_from_digraph6() additional arguments are passed to network::as.network()

See also

as_digraph6() for encoding objects as 'digraph6' symbols.

Examples

am <- matrix(rbinom(16, 1, 0.3), 4, 4)
d6 <- as_digraph6(am)

# To adjacency matrix ------------------------------------------------------
adjacency_from_digraph6(d6)
#> $`&CaR?`
#>      [,1] [,2] [,3] [,4]
#> [1,]    1    0    0    0
#> [2,]    1    0    0    1
#> [3,]    0    0    1    1
#> [4,]    0    0    0    0
#> 

# To igraph objects --------------------------------------------------------
if(requireNamespace("igraph", quietly=TRUE)) {
  igraph_from_digraph6(d6)
}
#> $`&CaR?`
#> IGRAPH ada4cca D--- 4 5 -- 
#> + edges from ada4cca:
#> [1] 1->1 2->1 2->4 3->3 3->4
#> 

# To network objects -------------------------------------------------------
if(requireNamespace("network", quietly=TRUE)) {
  network_from_digraph6(d6)
}
#> $`&CaR?`
#>  Network attributes:
#>   vertices = 4 
#>   directed = TRUE 
#>   hyper = FALSE 
#>   loops = FALSE 
#>   multiple = FALSE 
#>   bipartite = FALSE 
#>   total edges= 3 
#>     missing edges= 0 
#>     non-missing edges= 3 
#> 
#>  Vertex attribute names: 
#>     vertex.names 
#> 
#> No edge attributes
#>