Get number of vertices in neighbor_graph object
Source:R/neighbor_graph.R
nvertices.neighbor_graph.RdGet the number of vertices in a neighbor_graph object.
Usage
# S3 method for class 'neighbor_graph'
nvertices(x, ...)Examples
adj_matrix <- Matrix::Matrix(c(0, 1, 1, 0, 1, 0, 1, 0, 0),
nrow = 3, byrow = TRUE, sparse = TRUE)
ng <- neighbor_graph(adj_matrix)
nvertices(ng) # Should return 3
#> [1] 3