View source: R/network-summary.R
| network_summary | R Documentation |
Computes comprehensive network-level statistics for a network. Returns a data frame with one row containing various metrics including density, centralization scores, transitivity, and more.
network_summary(
x,
directed = NULL,
weighted = TRUE,
mode = "all",
loops = TRUE,
simplify = "sum",
detailed = FALSE,
extended = FALSE,
digits = 3,
...
)
x |
Network input: matrix, igraph, network, cograph_network, or tna object |
directed |
Logical or NULL. If NULL (default), auto-detect from matrix symmetry. Set TRUE to force directed, FALSE to force undirected. |
weighted |
Logical. Use edge weights for strength/centrality calculations. Default TRUE. |
mode |
For directed networks: "all", "in", or "out". Affects degree-based calculations. Default "all". |
loops |
Logical. If TRUE (default), keep self-loops. Set FALSE to remove them. |
simplify |
How to combine multiple edges between the same node pair. Options: "sum" (default), "mean", "max", "min", or FALSE/"none" to keep multiple edges. |
detailed |
Logical. If TRUE, include mean/sd centrality statistics. Default FALSE returns 18 basic metrics; TRUE returns 29 metrics. |
extended |
Logical. If TRUE, include additional structural metrics (girth, radius, clique size, cut vertices, bridges, efficiency). Default FALSE. |
digits |
Integer. Round numeric results to this many decimal places. Default 3. |
... |
Additional arguments (currently unused) |
A data frame with one row containing network-level statistics:
Basic measures (always computed):
Number of nodes in the network
Number of edges in the network
Edge density (proportion of possible edges)
Number of connected components
Longest shortest path in the network
Average shortest path length
Minimum cut value (edge connectivity)
Degree centralization (0-1)
In-degree centralization (directed only)
Out-degree centralization (directed only)
Betweenness centralization (0-1)
Closeness centralization (0-1)
Eigenvector centralization (0-1)
Global clustering coefficient
Proportion of mutual edges (directed only)
Degree assortativity coefficient
Maximum hub score (HITS algorithm)
Maximum authority score (HITS algorithm)
Extended measures (when extended = TRUE):
Length of shortest cycle (Inf if acyclic)
Minimum eccentricity (shortest max-distance from any node)
Minimum nodes to remove to disconnect graph
Size of the largest complete subgraph
Number of articulation points (cut vertices)
Number of bridge edges
Average inverse shortest path length
Average local efficiency across nodes
Detailed measures (when detailed = TRUE):
Degree distribution statistics
Weighted degree statistics
Average betweenness centrality
Average closeness centrality
Average eigenvector centrality
Average PageRank
Average Burt's constraint
Average local clustering coefficient
# Basic usage with adjacency matrix
adj <- matrix(c(0, 1, 1, 1, 0, 1, 1, 1, 0), 3, 3)
network_summary(adj)
# With detailed statistics
network_summary(adj, detailed = TRUE)
# With extended structural metrics
network_summary(adj, extended = TRUE)
# All metrics
network_summary(adj, detailed = TRUE, extended = TRUE)
# From igraph object
if (requireNamespace("igraph", quietly = TRUE)) {
g <- igraph::erdos.renyi.game(20, 0.3)
network_summary(g)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.