SNA.jl
Describe the structure of an observed network: who connects to whom, which actors lie between groups, how cohesive the network is, and which positions have similar tie patterns. SNA.jl provides centrality, cohesion, network measures, equivalence analysis and QAP inference on NetworkCore.jl objects.
Start here: Getting started · Centrality · Network measures · Cohesion · Coming from R sna · API
Find the connection between two groups
Use Julia 1.12+ and the workspace installation guide for the current 0.2.0 development version, unreleased. The examples assume that environment is already prepared.
using NetworkCore, SNA
# Two triangles joined by the tie between actors 3 and 4.
net = network(6; directed=false)
for (i, j) in [(1, 2), (1, 3), (2, 3), (3, 4), (4, 5), (4, 6), (5, 6)]
add_edge!(net, i, j)
end
betweenness(net) # [0, 0, 6, 6, 0, 0]: actors 3 and 4 broker
sort(cutpoints(net)) # [3, 4]
gden(net) # 7 / 15SNA.jl's measures carry R sna's names and defaults (degreecent, betweenness, closeness, evcent, gden, gtrans, kcores, sedist, …); Graphs.jl's own functions, such as betweenness_centrality, keep Graphs.jl's conventions. Actors 3 and 4 connect the groups: removing either disconnects the network. Betweenness quantifies their position on shortest paths. Such a structural position alone does not establish influence or a causal role.
Choose a measure that matches the question
| Question | Start with |
|---|---|
| Who has connections, reach or brokerage? | Degree, closeness, betweenness and spectral centrality |
| How dense, reciprocal or transitive is the network? | Global measures and dyad/triad censuses |
| Which groups or vulnerable connections exist? | Components, cores, cliques and cutpoints |
| Who has similar tie patterns or roles? | Structural/regular equivalence and blockmodels |
| Are two relations associated? | QAP tests and network regression |
| Is a statistic larger than density or the dyad census implies? | Conditional uniform graph tests |
| Who brokers between groups? | Gould–Fernandez brokerage |
Measures use binary ties by default. Selected routines support valued ties; shortest-path centralities currently use binary paths. Directed and two-mode conventions differ by measure, so read its API before comparing results.
Masked dyads are rejected by default. missing=:face explicitly uses their stored values; it is not a missing-data estimator. Regression covariance assumes independent dyads, while QAP p-values come from a separate permutation procedure. R sna 2.8 fixtures, including a corpus of 60 random networks, pin every measure; the R concordance lists the deliberate differences and the sna functions that are not implemented. See the tutorial's analysis checks.
For statistical models of a single network, see ERGM.jl. For temporal measures, see TSNA.jl; for network panels, Siena.jl.
Package citation: CITATION.bib.