The goal of netkit is to provide a comprehensive and user-friendly toolkit for network-based data analysis, particularly for biological systems analysis. It includes tools for flexible graph annotation, topological analysis, network visualization, and diffusion-based signal propagation.
What it does
Topology —
summarize_graph_metrics()for the graph as a whole andnode_metrics()for its vertices (eleven centrality and position measures in one call), plusplot_CCDF()andcompare_networks().Statistical testing —
null_model()builds degree-preserving random ensembles, andmetric_significance()scores an observed metric against them, so “modularity 0.42” becomes a z-score and an empirical p-value rather than a bare number.small_worldness()is the classic application.Node classification —
find_hubs(),find_bottlenecks(), andcalculate_roles(), which implements the R1–R7 connectivity cartography of Guimerà & Amaral, 2005.Subnetwork extraction —
extract_subnetwork()turns a gene list into a readable figure, by induced subgraph, neighborhood expansion, the union of shortest paths, an approximate Steiner tree, or diffusion-based expansion.Information flow —
network_diffusion()andnetwork_diffusion_with_pvalues(), the latter with a degree-matched permutation null, since diffusion scores are strongly degree-dependent.greedy_seed_selection()solves the inverse problem: given nodes you want to affect, which upstream nodes should you perturb?Robustness —
robustness_analysis()simulates targeted and random node removal following Albert et al., 2000.Visualization —
plot_Net()and friends, with node/edge metadata mapping, dynamic sizing, and layout control.
Analysis functions return a named list with a consistent vocabulary — plot, result, graph, method — which is what lets them chain:
g <- node_metrics(g)$graph # eleven metrics as vertex attributes
g <- find_hubs(g)$graph # plus is_hub
g <- find_modules(g)$graph # plus module
robustness_analysis(g, removal_strategy = "pagerank")At the console those results print as a summary — what was computed, the head of the table, and the shape of everything else — rather than as a dump of the whole graph. The objects are still plain lists; unclass() restores the default output.
Edge weights
Every function that can use edge weights takes weights and a weight_type declaring whether the values are a strength (confidence scores, correlations — larger means more tightly connected) or a distance (costs, dissimilarities — larger means further apart). netkit ignores edge weights unless asked, and warns when a graph carries a weight attribute it is ignoring.
That is deliberate, and differs from plain igraph, which reads the attribute automatically while giving it opposite meanings in different functions — a cost in betweenness() and distances(), a strength in cluster_louvain(). See vignette("weighted-networks").
With a special scope to generate high-quality and interpretable figures suitable for publication, most of the functions generate both tabular results and diagnostic plots. Altogether, netkit is designed to help researchers explore, interpret, and visualize complex networks with minimal friction and maximum insight.
Installation
You can install the development version of netkit from GitHub using the devtools or remotes package:
# If not already installed:
install.packages("devtools")
# Install netkit from GitHub
devtools::install_github("agallinat/netkit")Documentation
Full usage examples and tutorial are available in the package vignettes:
browseVignettes("netkit")Or online:
Contributing
Contributions are welcome! If you’d like to report a bug, suggest a feature, or improve documentation, please open an issue or submit a pull request at:
https://github.com/agallinat/netkit/issues
For larger changes, feel free to open a discussion first.