Provides a comprehensive summary of mutual k-nearest neighbor graphs created
by create.mknn.graphs, including structural statistics and connectivity
information for each k value.
Usage
# S3 method for class 'mknn_graphs'
summary(object, ...)Value
Invisibly returns a data frame containing graph statistics with columns:
- idx
Index of the k value (1 to number of graphs)
- k
The k value used for the graph
- n_components
Number of connected components
- n_edges
Number of edges in the graph
- mean_degree
Average vertex degree
- min_degree
Minimum vertex degree
- max_degree
Maximum vertex degree
- density
Graph density (proportion of possible edges present)
- sparsity
Graph sparsity (1 - density)
Details
The summary provides insights into how graph structure changes with k:
Connected Components: Indicates graph fragmentation. A value of 1 means the graph is fully connected.
Degree Statistics: Shows the distribution of vertex connectivity. Large differences between min and max degree may indicate hub vertices.
Density/Sparsity: Measures how many of the possible edges are present. MkNN graphs are typically very sparse.
For pruned graphs, the statistics reflect the structure after geometric pruning has been applied.
Examples
graphs <- create.mknn.graphs(matrix(c(0, 1, 3, 6, 9), ncol = 1),
k.values = 1:3, compute.full = TRUE, verbose = FALSE)
summary(graphs)
#> Mutual k-Nearest Neighbor Graphs Summary
#> ========================================
#> Number of vertices: 5
#> k range: 1 to 3
#> Pruning threshold: 1.20
#>
#> Graph Statistics:
#> -----------------
#> idx k n_components n_edges mean_degree min_degree max_degree density sparsity
#> 1 1 4 1 0.40 0 1 0.10000 0.90000
#> 2 2 2 3 1.20 1 2 0.30000 0.70000
#> 3 3 1 4 1.60 1 2 0.40000 0.60000
#>
#> Pruning Summary:
#> ----------------
#> Total edges removed: 3 of 11 (27.3%)