| summary.mknn_graphs | R Documentation |
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.
## S3 method for class 'mknn_graphs'
summary(object, ...)
object |
An object of class "mknn_graphs", typically output from
|
... |
Additional arguments (currently unused). |
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.
Invisibly returns a data frame containing graph statistics with columns:
Index of the k value (1 to number of graphs)
The k value used for the graph
Number of connected components
Number of edges in the graph
Average vertex degree
Minimum vertex degree
Maximum vertex degree
Graph density (proportion of possible edges present)
Graph sparsity (1 - density)
mknn_result <- list(
pruned_graphs = list(
list(adj_list = list(c(2L), c(1L, 3L), c(2L))),
list(adj_list = list(c(2L, 3L), c(1L, 3L), c(1L, 2L)))
),
k_statistics = data.frame(
k = 2:3,
n_edges = c(2L, 3L),
n_edges_pruned = c(2L, 3L),
n_removed = c(0L, 0L),
reduction_ratio = c(0, 0)
)
)
attr(mknn_result, "kmin") <- 2L
attr(mknn_result, "kmax") <- 3L
attr(mknn_result, "n_vertices") <- 3L
attr(mknn_result, "max.path.edge.ratio.thld") <- 1.2
class(mknn_result) <- "mknn_graphs"
stats <- summary(mknn_result)
plot(stats$k, stats$mean_degree, type = "b",
xlab = "k", ylab = "Mean Degree")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.