Building a co-offending network and measuring who is central in it.
Each section is one help page: what the function is for, the example
of its help page as it runs, and the plot of its result where the
package draws one. ?name gives the arguments and the value
in full.
coofg(): The one-mode projection of offenders onto
incidents: two offenders are joined when they are recorded in the same
incident, and the weight of the tie is the number of incidents they
share. An offender recorded twice in one incident counts once there.
Offenders who never offend with anyone appear in nodes but
in no edge; give nodes to the network functions to keep
them as isolated nodes.
ntdeg(): A graph is an edge list: from[k]
is tied to to[k]. The rules below hold for every network
function in crimlab.
ntbtw(): The sum, over pairs of other nodes, of the
share of their shortest paths that pass through the node (Freeman 1977),
by Brandes’ algorithm in O(nodes x edges) time. Paths are counted in
steps: weights are tie strengths, not lengths, and are not taken. An
undirected pair is counted once. Graph rules as in
ntdeg().
ntcls(): Distances are counted in steps (weights are not
taken), along edges’ directions when dir = TRUE
(out-distances). A disconnected graph is handled in the two standard
ways, both returned: cls and ncls count only
the nodes a node reaches (as igraph::closeness() does), so
a node close to the few it reaches scores high; hrm, the
harmonic centrality, sums 1 / distance over every other
node, an unreachable one adding 0, so reaching more nodes always scores
more. Graph rules as in ntdeg().
ntevc(): The leading eigenvector of the (weighted)
adjacency matrix of the undirected graph, scaled to a maximum of 1
(Bonacich 1972). It is found by power iteration on A + c I,
c the largest weight, which has the same eigenvectors and
whose leading eigenvalue is strictly dominant even on a bipartite graph
(a co-offending network between two roles, a star), where plain power
iteration oscillates. The iteration starts from 1 for every node and
stops when no value changes by tol or more between two
steps, or after maxit steps (then conv is
FALSE).
ntcore(): The coreness of a node is the largest k such
that it belongs to a subgraph in which every node has at least k
neighbours (Seidman 1983), computed in O(nodes + edges) by the algorithm
of Batagelj and Zaversnik. The cores are nested: the (k + 1)-core lies
inside the k-core (proof("ntcore")). Edges are taken as
undirected, without weights. Graph rules as in ntdeg().
ntcmp(): Weak components join nodes linked by edges in
either direction; strong components (Tarjan’s algorithm, without
recursion) join nodes that reach each other along the edges’ directions.
Undirected, the two coincide. Components are numbered 1, 2, … in the
order of their first node. Graph rules as in ntdeg().
ntlvn(): Groups nodes to raise the modularity (see
ntmod()) of the undirected, weighted graph (Blondel et
al. 2008). Each level visits the nodes in node order when
seed is NULL, or in a random order drawn from
seed (one stream for the whole run), and moves each to the
neighbouring community with the largest gain in modularity, the first
met among equal gains, when that gain beats staying by more than 1e-12
of the node’s strength; passes repeat until none moves a node. The
communities then become the nodes of the next level, and a level that
moves nothing ends the run. The result is the same on every platform for
the same input and seed.
ntmod(): Q = sum over communities of in / 2m - res (tot
/ 2m)^2, where in is the weight of edges inside the community (counted
from both ends), tot the summed strength of its nodes and
2m the total strength (Newman and Girvan 2004), on the undirected,
weighted graph. At res = 1 it lies between -1/2 and 1
(proof("ntmod")). NaN for a graph without
edges. Graph rules as in ntdeg().
ntbrk(): Counts, for each node v, the two-paths
i -> v -> j with i != j and no tie
i -> j (v brokers between them), by the roles of Gould
and Fernandez (1989), given each node’s group: coord
(coordinator: i, v and j in one group), itin (itinerant: i
and j in one group, v in another), repr (representative: v
in i’s group, j outside), gate (gatekeeper: v in j’s group,
i outside) and liais (liaison: three groups). Undirected,
each tie runs both ways, so each unordered pair of neighbours counts
twice and repr equals gate. Weights are not
taken. Graph rules as in ntdeg(). Raw counts only: the
expected counts and z-scores of Gould and Fernandez are not given.
ntchg(): The conductance of a set of nodes S is the
weight of the edges leaving it over the smaller of its volume and that
of the rest (volume: summed strength); the graph’s conductance h is the
least over all sets, a measure of how cleanly the network splits in two.
Finding h is hard, but the second-smallest eigenvalue
lambda2 of the normalised Laplacian I - D^-1/2 A D^-1/2
brackets it: lambda2 / 2 <= h <= sqrt(2 lambda2) (Cheeger’s
inequality; the lower half is proof("ntchg")). The sweep
over the eigenvector finds a set whose conductance (sweep)
is at most sqrt(2 lambda2); h is at most sweep.