Check if an argument is a ìgraph
object from igraph
package
with contiguity graph properties, i.e. being simple and undirected.
Usage
checkContiguityGraph(g, n = gorder(g))
assertContiguityGraph(
g,
n = gorder(g),
.var.name = checkmate::vname(g),
add = NULL
)
testContiguityGraph(g, n = gorder(g))
Arguments
- g
The argument to try.
- n
The order (number of vertices)
g
is supposed to have. By default this number is arbitrary.- .var.name
Name of the checked object to print in assertions. Defaults to the heuristic implemented in
checkmate::vname()
.- add
Collection to store assertion messages. See checkmate::AssertCollection.
Value
Please see checkmate::checkMatrix()
help page (for instance)
for further details about the difference between check_, test_ and assert_
functions results.
See also
Other arguments checkers:
checkContiguityMatrix()
,
checkDistanceMatrix()
,
checkPartition()
,
checkRegionalisation()
Examples
require(igraph)
#> Loading required package: igraph
#>
#> Attaching package: ‘igraph’
#> The following object is masked from ‘package:c3t’:
#>
#> is_connected
#> The following objects are masked from ‘package:stats’:
#>
#> decompose, spectrum
#> The following object is masked from ‘package:base’:
#>
#> union
graph <- make_graph(c(1, 2, 2, 3, 3, 1), directed = FALSE)
checkContiguityGraph(graph) # TRUE
#> [1] TRUE