nvertices: Number of Vertices in Graph-like Objects

View source: R/all_generic.R

nverticesR Documentation

Number of Vertices in Graph-like Objects

Description

Retrieve the number of vertices in a neighbor_graph object.

Usage

nvertices(x, ...)

Arguments

x

an object with a neighborhood

...

Additional arguments (currently ignored).

Value

The number of vertices in the neighbor_graph object.

Examples

# Create a small example graph
adj_matrix <- matrix(c(0, 1, 1, 0, 1, 0, 1, 0, 0), nrow = 3, byrow = TRUE)
ng <- neighbor_graph(adj_matrix)
nvertices(ng) # Should return 3


bbuchsbaum/neighborweights documentation built on April 1, 2024, 8:41 p.m.