These functions take a vector of 'graph6' symbols and return a list of other types of objects:
adjacency_from_graph6()
creates adjacency matrices
igraph_from_graph6()
creates 'igraph' objects. Requires package igraph to be installed.
network_from_graph6()
creates network objects. Requires package network to be installed.
Value
The returned object is:
for
adjacency_from_graph6()
, a list of the same length as its input of square symmetric adjacency matrices.
for
igraph_from_graph6()
, a list of 'igraph' objects
for
network_from_graph6()
, a list of network objects
Details
For igraph_from_graph6()
additional arguments are passed to
igraph::graph_from_adjacency_matrix()
For network_from_graph6()
additional arguments are passed to
network::as.network()
See also
as_graph6()
for saving objects as 'graph6' symbols.
Examples
A <- matrix(c(0,1,0,1,
1,0,1,0,
0,1,0,1,
1,0,1,0), 4, 4, byrow = TRUE)
g6 <- as_graph6(A)
# To adjacency matrix ------------------------------------------------------
adjacency_from_graph6(g6)
#> $Cl
#> [,1] [,2] [,3] [,4]
#> [1,] 0 1 0 1
#> [2,] 1 0 1 0
#> [3,] 0 1 0 1
#> [4,] 1 0 1 0
#>
# To igraph objects --------------------------------------------------------
if(requireNamespace("igraph", quietly=TRUE)) {
igraph_from_graph6(g6)
}
#> $Cl
#> IGRAPH f845657 U--- 4 4 --
#> + edges from f845657:
#> [1] 1--2 1--4 2--3 3--4
#>
# To network objects -------------------------------------------------------
if(requireNamespace("network", quietly=TRUE)) {
network_from_graph6(g6)
}
#> $Cl
#> Network attributes:
#> vertices = 4
#> directed = FALSE
#> hyper = FALSE
#> loops = FALSE
#> multiple = FALSE
#> bipartite = FALSE
#> total edges= 4
#> missing edges= 0
#> non-missing edges= 4
#>
#> Vertex attribute names:
#> vertex.names
#>
#> No edge attributes
#>