Package 'netrics'

Title: Many Marks, Measures, Memberships, and Motifs for Networks
Description: Many tools for calculating network, node, or tie marks, measures, motifs and memberships of many different types of networks. Marks identify structural positions, measures quantify network properties, memberships classify nodes into groups, and motifs tabulate substructure participation. All functions operate with all classes of network data covered in 'manynet', and on directed, undirected, multiplex, multimodal, signed, and other networks.
Authors: James Hollway [cre, aut, ctb] (IHEID, ORCID: <https://orcid.org/0000-0002-8361-9647>)
Maintainer: James Hollway <[email protected]>
License: MIT + file LICENSE
Version: 1.1.3
Built: 2026-10-18 11:47:37 UTC
Source: https://github.com/stocnet/netrics

Help Index


Marks of nodes as core or periphery

Description

node_is_core() identifies whether nodes belong to the core of the network, as opposed to the periphery.

Usage

node_is_core(
  .data,
  coreness = NULL,
  direction = c("all", "out", "in"),
  centrality = NULL
)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

coreness

Which method to use to calculate nodes' coreness. One of "correlation", "rich", "transition", or "hub"; see method_coreness for what each does. By default NULL, which uses "rich" for a weighted, directed, or two-mode network, since it is the only method that reads those properties directly, and "correlation" otherwise.

direction

One of "all" (the default), "out", or "in". For a directed network, "out" scores nodes on the ties they send and "in" on the ties they receive. Ignored for undirected and two-mode networks.

centrality

Deprecated; use coreness instead.

Value

A node_mark logical vector the length of the nodes in the network, giving either TRUE or FALSE for each node depending on whether the condition is matched.

Core-periphery

This function is used to identify which nodes should belong to the core, and which to the periphery. It seeks to minimize the following quantity:

Z(S1)=∑(i<j)∈S1I{Aij=0}+∑(i<j)∉S1I{Aij=1}Z(S_1) = \sum_{(i<j)\in S_1} \textbf{I}_{\{A_{ij}=0\}} + \sum_{(i<j)\notin S_1} \textbf{I}_{\{A_{ij}=1\}}

where nodes {i,j,...,n}\{i,j,...,n\} are ordered in descending coreness, AA is the adjacency matrix, and the indicator function is 1 if the predicate is true or 0 otherwise. Note that minimising this quantity maximises density in the core block and minimises density in the periphery block; it ignores ties between these blocks.

Which ordering the nodes are swept in depends on the method named by coreness, for which see method_coreness.

References

On core-periphery partitioning

Borgatti, Stephen P., and Martin G. Everett. 2000. "Models of core/periphery structures". Social Networks, 21(4), 375-395. doi:10.1016/S0378-8733(99)00019-2

Lip, Sean Z. W. 2011. "A fast algorithm for the discrete core/periphery bipartitioning problem". doi:10.48550/arXiv.1102.5511

See Also

Other core-periphery: measure_core, member_core

Other marks: mark_degree, mark_diff, mark_dyads, mark_nodes, mark_select_node, mark_select_tie, mark_ties, mark_triangles

Other nodal: mark_degree, mark_diff, mark_nodes, mark_select_node, measure_accuracy_node, measure_assort_node, measure_broker_node, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_closure_node, measure_core, measure_diffusion_node, measure_diverse_node, member_brokerage, member_cliques, member_community, member_community_hier, member_community_modular, member_community_partition, member_community_spread, member_components, member_core, member_diffusion, member_equivalence, motif_accuracy_node, motif_brokerage_node, motif_clique, motif_composition, motif_exposure, motif_node, motif_path

Examples

node_is_core(ison_adolescents)
ison_adolescents |> 
   mutate_nodes(corep = node_is_core())

Marks of nodes based on degree properties

Description

These functions return logical vectors the length of the nodes in a network identifying which hold certain properties or positions in the network.

  • node_is_isolate() marks nodes that are isolates, with neither incoming nor outgoing ties.

  • node_is_pendant() marks nodes that are pendants, with exactly one incoming or outgoing tie.

  • node_is_universal() identifies whether nodes are adjacent to all other nodes in the network.

Usage

node_is_isolate(.data)

node_is_pendant(.data)

node_is_universal(.data)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

Value

A node_mark logical vector the length of the nodes in the network, giving either TRUE or FALSE for each node depending on whether the condition is matched.

Universal/dominating node

A universal node is adjacent to all other nodes in the network. It is also sometimes called the dominating vertex because it represents a one-element dominating set. A network with a universal node is called a cone, and its universal node is called the apex of the cone. A classic example of a cone is a star graph, but friendship, wheel, and threshold graphs are also cones.

See Also

Other degree: measure_central_degree, measure_central_tie_degree, measure_centralisation_degree

Other marks: mark_core, mark_diff, mark_dyads, mark_nodes, mark_select_node, mark_select_tie, mark_ties, mark_triangles

Other nodal: mark_core, mark_diff, mark_nodes, mark_select_node, measure_accuracy_node, measure_assort_node, measure_broker_node, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_closure_node, measure_core, measure_diffusion_node, measure_diverse_node, member_brokerage, member_cliques, member_community, member_community_hier, member_community_modular, member_community_partition, member_community_spread, member_components, member_core, member_diffusion, member_equivalence, motif_accuracy_node, motif_brokerage_node, motif_clique, motif_composition, motif_exposure, motif_node, motif_path

Examples

node_is_isolate(ison_brandes)
node_is_universal(create_star(11))

Marks of nodes based on diffusion properties

Description

These functions return logical vectors the length of the nodes in a network identifying which hold certain properties or positions in the network.

  • node_is_infected() marks nodes that are infected by a particular time point.

  • node_is_exposed() marks nodes that are exposed to a given (other) mark.

  • node_is_latent() marks nodes that are latent at a particular time point.

  • node_is_recovered() marks nodes that are recovered at a particular time point.

Usage

node_is_latent(.data, time = 0)

node_is_infected(.data, time = 0)

node_is_recovered(.data, time = 0)

node_is_exposed(.data, mark, time = 0)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

time

A time step at which nodes are identified.

mark

vector denoting which nodes are infected

Value

A node_mark logical vector the length of the nodes in the network, giving either TRUE or FALSE for each node depending on whether the condition is matched.

Exposed

node_is_exposed() is similar to node_exposure(), but returns a mark (TRUE/FALSE) vector indicating which nodes are currently exposed to the diffusion content. This diffusion content can be expressed in the 'mark' argument. If no 'mark' argument is provided, and '.data' is a diff_model object, then the function will return nodes exposure to the seed nodes in that diffusion.

See Also

Other marks: mark_core, mark_degree, mark_dyads, mark_nodes, mark_select_node, mark_select_tie, mark_ties, mark_triangles

Other nodal: mark_core, mark_degree, mark_nodes, mark_select_node, measure_accuracy_node, measure_assort_node, measure_broker_node, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_closure_node, measure_core, measure_diffusion_node, measure_diverse_node, member_brokerage, member_cliques, member_community, member_community_hier, member_community_modular, member_community_partition, member_community_spread, member_components, member_core, member_diffusion, member_equivalence, motif_accuracy_node, motif_brokerage_node, motif_clique, motif_composition, motif_exposure, motif_node, motif_path

Other diffusion: measure_diffusion_infection, measure_diffusion_net, measure_diffusion_node, member_diffusion, motif_exposure, motif_hazard

Examples

# To mark nodes that are latent by a particular time point
  node_is_latent(play_diffusion(create_tree(6), latency = 1), time = 1)
  # To mark nodes that are infected by a particular time point
  node_is_infected(play_diffusion(create_tree(6)), time = 1)
  # To mark nodes that are recovered by a particular time point
  node_is_recovered(play_diffusion(create_tree(6), recovery = 0.5), time = 3)
  # To mark which nodes are currently exposed
  (expos <- node_is_exposed(manynet::create_tree(14), mark = c(1,3)))
  which(expos)

Marks of ties based on dyadic properties

Description

These functions return logical vectors the length of the ties in a network identifying which are embedded within particular dyads.

  • tie_is_multiple() marks ties that repeat an earlier tie between the same two nodes.

  • tie_is_reciprocated() marks ties that are mutual/reciprocated.

They are most useful in highlighting parts of the network where relationships are denser.

Usage

tie_is_multiple(.data)

tie_is_reciprocated(.data)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

Value

A tie_mark logical vector the length of the ties in the network, giving either TRUE or FALSE for each tie depending on whether the condition is matched.

Multiple and parallel ties

tie_is_multiple() and manynet::tie_is_parallel() answer different questions, and can give different answers on the same network.

tie_is_multiple() marks only the repeats, as igraph::which_multiple() does: the first tie between two nodes is FALSE, and each further tie between them is TRUE. It reads nothing but the two nodes a tie joins, so ties at different times, in different layers, or from different reporters all count as repeats of each other.

manynet::tie_is_parallel() marks every tie in such a bundle, the first included, but only where the ties coexist: at the same time or over overlapping intervals, in the same layer, and from the same reporter. Use it to ask whether a network holds ties that could be combined.

See Also

Other marks: mark_core, mark_degree, mark_diff, mark_nodes, mark_select_node, mark_select_tie, mark_ties, mark_triangles

Other tie: mark_select_tie, mark_ties, mark_triangles, measure_broker_tie, measure_central_tie_between, measure_central_tie_close, measure_central_tie_degree, measure_central_tie_eigen, measure_diverse_tie, member_community_link

Examples

tie_is_multiple(fict_marvel)
tie_is_reciprocated(ison_algebra)

Marks of nodes based on structural properties

Description

These functions return logical vectors the length of the nodes in a network identifying which hold certain properties or positions in the network.

  • node_is_independent() marks nodes that are members of the largest independent set, aka largest internally stable set.

  • node_is_cutpoint() marks nodes that cut or act as articulation points in a network, increasing the number of connected components when removed.

  • node_is_fold() marks nodes that are in a structural fold between two or more triangles that are only connected by that node.

  • node_is_mentor() marks a proportion of high indegree nodes as 'mentors' (see details).

  • node_is_neighbor() marks nodes that are neighbours of a given node.

Usage

node_is_independent(.data)

node_is_cutpoint(.data)

node_is_fold(.data)

node_is_mentor(.data, elites = 0.1)

node_is_neighbor(.data, node, cutoff = 1)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

elites

The proportion of nodes to be selected as mentors. By default this is set at 0.1. This means that the top 10% of nodes in terms of degree, or those equal to the highest rank degree in the network, whichever is the higher, will be used to select the mentors. In a two-mode network the mentors are selected within each mode.

Note that if nodes are equidistant from two mentors, they will choose one at random. If a node is without a path to a mentor, for example because they are an isolate, a tie to themselves (a loop) will be created instead. Note that this is a different default behaviour than that described in Valente and Davis (1999).

node

A node ID or name for which neighbors are to be marked.

cutoff

Integer scalar, the maximum path length considered. Paths longer than this are ignored, which restricts the measure to a node's local neighbourhood. Where a measure is defined over all paths by default, a negative value or NULL imposes no limit.

Details

For signed networks, node_is_fold() considers only the positive ties. It reads a tie as a distance, and a negative tie is hostility rather than a channel along which cohesion travels.

For multilevel networks, node_is_independent() marks the network whole, as net_by_independence() does. A multilevel network reports itself as two-mode, but holds ties within a mode as well as between them, so it cannot be projected onto one mode.

Value

A node_mark logical vector the length of the nodes in the network, giving either TRUE or FALSE for each node depending on whether the condition is matched.

Neighbourhoods

By default, node_is_neighbor() marks the nodes that node has a tie to. Given a cutoff, it instead marks every node that can be reached from node along a path no longer than cutoff, but not node itself. Where the ties have a 'length' attribute, such as manynet::read_geojson() measures along each line, a path is as long as the sum of the lengths of its ties, so that cutoff can be, for example, a travel distance or time (an isochrone); otherwise a path is as long as the number of ties it crosses. Weights are strengths and not distances, so they are not read.

References

On independent sets

Tsukiyama, Shuji, Mikio Ide, Hiromu Ariyoshi, and Isao Shirawaka. 1977. "A new algorithm for generating all the maximal independent sets". SIAM Journal on Computing, 6(3):505–517. doi:10.1137/0206036

On articulation or cut-points

Tarjan, Robert E. and Uzi Vishkin. 1985. "An Efficient Parallel Biconnectivity Algorithm", SIAM Journal on Computing 14(4): 862-874. doi:10.1137/0214061

On structural folds

Vedres, Balazs, and David Stark. 2010. "Structural folds: Generative disruption in overlapping groups", American Journal of Sociology 115(4): 1150-1190. doi:10.1086/649497

On mentoring

Valente, Thomas, and Rebecca Davis. 1999. "Accelerating the Diffusion of Innovations Using Opinion Leaders", Annals of the American Academy of Political and Social Science 566: 56-67.

See Also

Other marks: mark_core, mark_degree, mark_diff, mark_dyads, mark_select_node, mark_select_tie, mark_ties, mark_triangles

Other nodal: mark_core, mark_degree, mark_diff, mark_select_node, measure_accuracy_node, measure_assort_node, measure_broker_node, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_closure_node, measure_core, measure_diffusion_node, measure_diverse_node, member_brokerage, member_cliques, member_community, member_community_hier, member_community_modular, member_community_partition, member_community_spread, member_components, member_core, member_diffusion, member_equivalence, motif_accuracy_node, motif_brokerage_node, motif_clique, motif_composition, motif_exposure, motif_node, motif_path

Examples

node_is_independent(ison_adolescents)
node_is_cutpoint(ison_brandes)
node_is_fold(create_explicit(A-B, B-C, A-C, C-D, C-E, D-E))
node_is_neighbor(ison_adolescents, "Betty", cutoff = 2)

Marks of nodes based on measures

Description

These functions return logical vectors the length of the nodes in a network identifying which hold certain properties or positions in the network.

  • node_is_random() marks one or more nodes at random.

  • node_is_max() and node_is_min() are more generally useful for converting the results from some node measure into a mark-class object. They can be particularly useful for highlighting which node or nodes are key because they minimise or, more often, maximise some measure.

Usage

node_is_random(.data, select = 1)

node_is_max(node_measure, ranks = 1)

node_is_min(node_measure, ranks = 1)

node_is_mean(node_measure, ranks = 1)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

select

Number of elements to select (as TRUE).

node_measure

An object created by a node_ measure.

ranks

The number of ranks of max or min to return. For example, ranks = 3 will return TRUE for nodes with scores equal to any of the top (or, for node_is_min(), bottom) three scores. By default, ranks = 1.

Value

A node_mark logical vector the length of the nodes in the network, giving either TRUE or FALSE for each node depending on whether the condition is matched.

See Also

Other selection: mark_select_tie

Other marks: mark_core, mark_degree, mark_diff, mark_dyads, mark_nodes, mark_select_tie, mark_ties, mark_triangles

Other nodal: mark_core, mark_degree, mark_diff, mark_nodes, measure_accuracy_node, measure_assort_node, measure_broker_node, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_closure_node, measure_core, measure_diffusion_node, measure_diverse_node, member_brokerage, member_cliques, member_community, member_community_hier, member_community_modular, member_community_partition, member_community_spread, member_components, member_core, member_diffusion, member_equivalence, motif_accuracy_node, motif_brokerage_node, motif_clique, motif_composition, motif_exposure, motif_node, motif_path

Examples

node_is_random(ison_brandes, 2)
node_is_max(node_by_degree(ison_brandes))
node_is_min(node_by_degree(ison_brandes))
node_is_mean(node_by_degree(ison_brandes))

Marks of ties based on measures

Description

These functions return logical vectors the length of the ties in a network:

  • tie_is_random() marks one or more ties at random.

  • tie_is_max() and tie_is_min() are more useful for converting the results from some tie measure into a mark-class object. They can be particularly useful for highlighting which tie or ties are key because they minimise or, more often, maximise some measure.

Usage

tie_is_random(.data, select = 1)

tie_is_max(tie_measure)

tie_is_min(tie_measure)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

select

Number of elements to select (as TRUE).

tie_measure

An object created by a tie_ measure, or a plain numeric vector holding one value per tie.

Value

A tie_mark logical vector the length of the ties in the network, giving either TRUE or FALSE for each tie depending on whether the condition is matched.

See Also

Other marks: mark_core, mark_degree, mark_diff, mark_dyads, mark_nodes, mark_select_node, mark_ties, mark_triangles

Other tie: mark_dyads, mark_ties, mark_triangles, measure_broker_tie, measure_central_tie_between, measure_central_tie_close, measure_central_tie_degree, measure_central_tie_eigen, measure_diverse_tie, member_community_link

Other selection: mark_select_node

Examples

tie_is_max(tie_by_betweenness(ison_brandes))
tie_is_min(tie_by_betweenness(ison_brandes))

Marks of ties based on structural properties

Description

These functions return logical vectors the length of the ties in a network identifying which hold certain properties or positions in the network.

  • tie_is_loop() marks ties that are loops.

  • tie_is_feedback() marks ties that are feedback arcs causing the network to not be acyclic.

  • tie_is_bridge() marks ties that cut or act as articulation points in a network.

  • tie_is_path() marks ties on a path from one node to another.

They are most useful in highlighting parts of the network that are particularly well- or poorly-connected.

Usage

tie_is_loop(.data)

tie_is_feedback(.data)

tie_is_bridge(.data)

tie_is_path(.data, from, to, all_paths = FALSE)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

from

The index or name of the node from which the path should start.

to

The index or name of the node to which the path should be traced.

all_paths

Whether to return a list of paths or sample just one. By default FALSE, sampling just a single path.

Value

A tie_mark logical vector the length of the ties in the network, giving either TRUE or FALSE for each tie depending on whether the condition is matched.

See Also

Other marks: mark_core, mark_degree, mark_diff, mark_dyads, mark_nodes, mark_select_node, mark_select_tie, mark_triangles

Other tie: mark_dyads, mark_select_tie, mark_triangles, measure_broker_tie, measure_central_tie_between, measure_central_tie_close, measure_central_tie_degree, measure_central_tie_eigen, measure_diverse_tie, member_community_link

Examples

tie_is_loop(fict_marvel)
tie_is_feedback(ison_algebra)
tie_is_bridge(ison_brandes)
ison_adolescents |>
  mutate_ties(route = tie_is_path(from = "Jane", to = 7))

Marks of ties based on triangular properties

Description

These functions return logical vectors the length of the ties in a network identifying which hold certain properties or positions in the network.

  • tie_is_triangular() marks ties that are part of triangles.

  • tie_is_cyclical() marks ties that are part of cycles.

  • tie_is_triplet() marks ties that are part of transitive triplets.

  • tie_is_simmelian() marks ties that are both in a triangle and fully reciprocated.

  • tie_is_imbalanced() marks ties that are part of imbalanced triads.

  • tie_is_transitive() marks ties that complete transitive closure.

They are most useful in highlighting parts of the network that are cohesively connected.

Usage

tie_is_triangular(.data)

tie_is_transitive(.data)

tie_is_triplet(.data)

tie_is_cyclical(.data)

tie_is_simmelian(.data)

tie_is_imbalanced(.data)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

Details

For signed networks, each tie is read by its magnitude, and every tie keeps its place in the returned vector. These marks ask only whether a two-path exists, as a census does, so a tie counts however it is signed.

Value

A tie_mark logical vector the length of the ties in the network, giving either TRUE or FALSE for each tie depending on whether the condition is matched.

See Also

Other marks: mark_core, mark_degree, mark_diff, mark_dyads, mark_nodes, mark_select_node, mark_select_tie, mark_ties

Other tie: mark_dyads, mark_select_tie, mark_ties, measure_broker_tie, measure_central_tie_between, measure_central_tie_close, measure_central_tie_degree, measure_central_tie_eigen, measure_diverse_tie, member_community_link

Other cohesion: measure_breadth, measure_cohesion, measure_fragmentation, motif_net, motif_node

Examples

ison_monks |> to_uniplex("like") |> 
  mutate_ties(tri = tie_is_triangular())
ison_adolescents |> to_directed() |> 
  mutate_ties(trans = tie_is_transitive())
ison_adolescents |> to_directed() |> 
  mutate_ties(trip = tie_is_triplet())
ison_adolescents |> to_directed() |> 
  mutate_ties(cyc = tie_is_cyclical())
ison_monks |> to_uniplex("like") |> 
  mutate_ties(simmel = tie_is_simmelian())
fict_marvel |> to_uniplex("relationship") |> tie_is_imbalanced()

Measures of network accuracy

Description

net_by_accuracy() measures how well the nodes' reports of a cognitive social structure agree with an ideal network, on average. It is the mean of node_by_accuracy() over the nodes, from 0 to 1 where every report is the ideal.

Usage

net_by_accuracy(.data, ideal = NULL, variant = c("hamming", "jaccard"))

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

ideal

The ideal network to compare each report against, with the same nodes as the network. By default, the locally aggregated structure of the network itself.

variant

Character string naming which variant of the measure to compute, where more than one definition of the same quantity is in use. The variant chosen is reported when the result is printed.

Value

A network_measure numeric score.

The object also carries the measure it computed, the range its values can fall within, and whether and how those values were normalized. These are shown as a one-line header when the object is printed. Where a measure offers a choice between several ways of counting the same thing, it also carries the variant it used. All can be retrieved with attr().

See Also

Other features: measure_accuracy_node, measure_features, measure_fit, motif_accuracy_node

Other measures: measure_accuracy_node, measure_assort_net, measure_assort_node, measure_breadth, measure_broker_node, measure_broker_tie, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_central_tie_between, measure_central_tie_close, measure_central_tie_degree, measure_central_tie_eigen, measure_closure, measure_closure_node, measure_cohesion, measure_core, measure_diffusion_infection, measure_diffusion_net, measure_diffusion_node, measure_diverse_net, measure_diverse_node, measure_diverse_tie, measure_features, measure_fit, measure_fragmentation, measure_hierarchy, measure_periods

Examples

net_by_accuracy(ison_hightech)

Measures of reporter accuracy

Description

node_by_accuracy() measures how well each node's report of a cognitive social structure agrees with an ideal network, from 0 to 1 where the report is the ideal.

A cognitive social structure (Krackhardt 1987) asks each node to report the ties of the whole network. Each report is compared with the ideal tie by tie. By default, the ideal is the locally aggregated structure, where a tie exists if both of its ends report it. Note that this ideal uses each node's reports of its own ties, so a node agrees with it on part of its own dyads. For a different ideal, such as a consensus structure, give it as ideal, e.g. manynet::to_flat(.data, attribute = "by"). Where the network holds several layers of reports, each layer is compared with the same layer of the ideal, and the cells are pooled.

There are two variants:

  • "hamming" (the default) is the share of possible ties on which the report and the ideal agree, whether on a tie or on its absence. This is the classic accuracy. Most possible ties are absent in a sparse network, so a node that reports few ties can still score high.

  • "jaccard" is the share of ties in either the report or the ideal that are in both. It ignores ties absent from both.

These are one minus the "hamming" and "jaccard" variants of net_by_divergence() between each node's report and the ideal. For the counts of each kind of agreement and error, see node_x_accuracy().

Usage

node_by_accuracy(.data, ideal = NULL, variant = c("hamming", "jaccard"))

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

ideal

The ideal network to compare each report against, with the same nodes as the network. By default, the locally aggregated structure of the network itself.

variant

Character string naming which variant of the measure to compute, where more than one definition of the same quantity is in use. The variant chosen is reported when the result is printed.

Value

A node_measure numeric vector the length of the nodes in the network, providing the scores for each node. If the network is labelled, then the scores will be labelled with the nodes' names.

The object also carries the measure it computed, the range its values can fall within, and whether and how those values were normalized. These are shown as a one-line header when the object is printed. Where a measure offers a choice between several ways of counting the same thing, it also carries the variant it used. All can be retrieved with attr().

References

On cognitive social structures

Krackhardt, David. 1987. "Cognitive social structures". Social Networks 9(2): 109-134. doi:10.1016/0378-8733(87)90009-8

See Also

Other features: measure_accuracy_net, measure_features, measure_fit, motif_accuracy_node

Other measures: measure_accuracy_net, measure_assort_net, measure_assort_node, measure_breadth, measure_broker_node, measure_broker_tie, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_central_tie_between, measure_central_tie_close, measure_central_tie_degree, measure_central_tie_eigen, measure_closure, measure_closure_node, measure_cohesion, measure_core, measure_diffusion_infection, measure_diffusion_net, measure_diffusion_node, measure_diverse_net, measure_diverse_node, measure_diverse_tie, measure_features, measure_fit, measure_fragmentation, measure_hierarchy, measure_periods

Other nodal: mark_core, mark_degree, mark_diff, mark_nodes, mark_select_node, measure_assort_node, measure_broker_node, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_closure_node, measure_core, measure_diffusion_node, measure_diverse_node, member_brokerage, member_cliques, member_community, member_community_hier, member_community_modular, member_community_partition, member_community_spread, member_components, member_core, member_diffusion, member_equivalence, motif_accuracy_node, motif_brokerage_node, motif_clique, motif_composition, motif_exposure, motif_node, motif_path

Examples

node_by_accuracy(ison_hightech)
node_by_accuracy(ison_hightech, variant = "jaccard")

Measures of network assortativity

Description

These functions offer ways to measure the distribution or assortativity of ties in a network:

  • net_by_heterophily() measures how embedded nodes in the network are within groups of nodes with the same attribute.

  • net_by_homophily() measures how embedded nodes in the network are within groups of nodes with the same attribute, but with more options for method.

  • net_by_assortativity() measures the degree assortativity in a network.

  • net_by_spatial() measures the spatial association/autocorrelation (global Moran's I) in a network. It is net_by_homophily() with assortativity = "moran", but it also reads two-mode networks (see below).

Note that for two-mode networks, homophily is calculated on the mode with the attribute of interest, and the other mode is ignored. If the attribute is present on both modes, homophily is calculated on the first mode by default, but a message is given and the user can choose to calculate homophily on the other mode instead by subsetting the attribute vector and converting the network to a one-mode network.

Usage

net_by_heterophily(.data, attribute)

net_by_homophily(
  .data,
  attribute,
  assortativity = c("ie", "ei", "yule", "geary", "moran")
)

net_by_assortativity(.data)

net_by_spatial(.data, attribute)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

attribute

Name of a nodal attribute, mark, measure, or membership vector.

assortativity

Which method to use for ⁠*_homophily()⁠. Either "ie" (negative E-I index), "ei" (E-I index), "yule" (Yule's Q), "geary" (Geary's C), or "moran" (Moran's I). Default is "ie". The first three are for categorical attributes, and the last two for numeric attributes. The E-I index is the number of ties between (or external) nodes grouped in some mutually exclusive categories minus the number of ties within (or internal) these groups divided by the total number of ties. This value can range from 1 to -1, where 1 indicates ties only between categories/groups and -1 ties only within categories/groups.

Yule's Q is a measure of association for two binary variables, calculated as:

Q=ad−bcad+bcQ = \frac{ad - bc}{ad + bc}

where aa is the number of ties between nodes in the same category, bb is the number of ties between nodes in different categories, cc is the number of non-ties between nodes in the same category, and dd is the number of non-ties between nodes in different categories. This value can range from -1 to 1, where 1 indicates perfect association (all ties are between nodes in the same category), -1 indicates perfect disassociation (all ties are between nodes in different categories), and 0 indicates no association.

Geary's C is a measure of spatial autocorrelation, calculated as:

C=(n−1)∑i=1n∑j=1nwij(xi−xj)22W∑i=1n(xi−xˉ)2C = \frac{(n - 1) \sum \limits_{i=1}^n \sum\limits_{j=1}^n w_{ij} (x_i - x_j)^2}{2W \sum\limits_{i=1}^n (x_i - \bar{x})^2}

where nn is the number of nodes, wijw_{ij} is the weight of the tie between nodes ii and jj, xix_i is the attribute value of node ii, xˉ\bar{x} is the mean attribute value across all nodes, and WW is the sum of all tie weights. This value can range from 0 to 2, where values less than 1 indicate positive autocorrelation (similar values are more likely to be connected), values greater than 1 indicate negative autocorrelation (dissimilar values are more likely to be connected), and a value of 1 indicates no autocorrelation. The upper bound of 2 holds where every tie carries the same weight. Geary's C reads the weights where the network has them, and a heavy tie between dissimilar values can then carry the sum past 2, so a weighted network declares the upper end open.

Moran's I is a measure of spatial autocorrelation, calculated as:

I=nW∑i=1n∑j=1nwij(xi−xˉ)(xj−xˉ)∑i=1n(xi−xˉ)2I = \frac{n}{W} \frac{\sum\limits_{i=1}^n \sum\limits_{j=1}^n w_{ij} (x_i - \bar{x})(x_j - \bar{x})}{\sum\limits_{i=1}^n (x_i - \bar{x})^2}

with the same terms as Geary's C. Positive values indicate that tied nodes hold similar values, and negative values that they hold dissimilar ones, so it runs the same way as the "ie" index, and the other way to Geary's C. See the section on spatial autocorrelation for its range. If an incompatible method is chosen for the attribute type, a suitable alternative will be used instead with a message.

Value

A network_measure numeric score.

The object also carries the measure it computed, the range its values can fall within, and whether and how those values were normalized. These are shown as a one-line header when the object is printed. Where a measure offers a choice between several ways of counting the same thing, it also carries the variant it used. All can be retrieved with attr().

Heterophily

Given a partition of a network into a number of mutually exclusive groups then The E-I index is the number of ties between (or external) nodes grouped in some mutually exclusive categories minus the number of ties within (or internal) these groups divided by the total number of ties. This value can range from 1 to -1, where 1 indicates ties only between categories/groups and -1 ties only within categories/groups.

Spatial autocorrelation

Moran's I is conventionally read on [−1,1][-1, 1], where positive values indicate that tied nodes hold similar values and negative values that they hold dissimilar ones. Its actual bounds, however, are set by the eigenvalues of the weight matrix, and on the unstandardised weights used here it can fall outside that interval. Its range is therefore declared open at both ends, and the conventional interval read as a guide rather than a guarantee.

A two-mode network has no ties within a mode, so where the attribute is present on one mode only, the network is first projected onto that mode. Two nodes are then neighbours where they are at distance 2, weighted by the number of nodes of the other mode that they share. Those counts make the weight matrix denser and WW larger than in a one-mode network, so a projected value is read within a network rather than across networks. Where the attribute is present on both modes, the whole multilevel matrix is read instead, and every node and tie is retained.

Nodes with a missing attribute value are dropped, along with their ties, and NN, WW and xˉ\bar{x} are recomputed on those that remain. A missing tie counts as no tie.

References

On heterophily

Krackhardt, David, and Robert N. Stern. 1988. Informal networks and organizational crises: an experimental simulation. Social Psychology Quarterly 51(2): 123-140. doi:10.2307/2786835

McPherson, Miller, Lynn Smith-Lovin, and James M. Cook. 2001. "Birds of a Feather: Homophily in Social Networks". Annual Review of Sociology, 27(1): 415-444. doi:10.1146/annurev.soc.27.1.415

On assortativity

Newman, Mark E.J. 2002. "Assortative mixing in networks". Physical Review Letters, 89(20): 208701. doi:10.1103/physrevlett.89.208701

On spatial autocorrelation

Moran, Patrick Alfred Pierce. 1950. "Notes on continuous stochastic phenomena". Biometrika 37(1): 17-23. doi:10.2307/2332142

See Also

Other diversity: measure_assort_node, measure_diverse_net, measure_diverse_node, measure_diverse_tie, motif_composition, motif_homophily

Other measures: measure_accuracy_net, measure_accuracy_node, measure_assort_node, measure_breadth, measure_broker_node, measure_broker_tie, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_central_tie_between, measure_central_tie_close, measure_central_tie_degree, measure_central_tie_eigen, measure_closure, measure_closure_node, measure_cohesion, measure_core, measure_diffusion_infection, measure_diffusion_net, measure_diffusion_node, measure_diverse_net, measure_diverse_node, measure_diverse_tie, measure_features, measure_fit, measure_fragmentation, measure_hierarchy, measure_periods

Examples

marvel_friends <- to_unsigned(to_uniplex(fict_marvel, "relationship"), "positive")
net_by_heterophily(marvel_friends, "Gender")
net_by_heterophily(marvel_friends, "Attractive")
net_by_homophily(marvel_friends, "Gender")
net_by_assortativity(ison_networkers)
net_by_spatial(ison_lawfirm, "age")

Measures of node assortativity

Description

These functions offer ways to measure nodes' assortativity in a network:

  • node_by_heterophily() measures each node's embeddedness within groups of nodes with the same attribute.

  • node_by_homophily() measures each node's embeddedness within groups of nodes with the same attribute, using a variety of methods.

For most methods, node_by_homophily() applies the network measure to each node's ego network, the node and its neighbours. For "moran" it instead returns local Moran's I (Anselin 1995),

Ii=xi−xˉm2∑jwij(xj−xˉ)I_i = \frac{x_i - \bar{x}}{m_2} \sum\limits_{j} w_{ij} (x_j - \bar{x})

where m2=∑i(xi−xˉ)2/nm_2 = \sum_i (x_i - \bar{x})^2 / n. A positive value marks a node that holds a value like its neighbours', both high or both low, and a negative value a node unlike its neighbours. The local values sum to WW times the global Moran's I of net_by_homophily(). A node with a missing value is NA.

Usage

node_by_heterophily(.data, attribute)

node_by_homophily(
  .data,
  attribute,
  assortativity = c("ie", "ei", "yule", "geary", "moran")
)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

attribute

Name of a nodal attribute, mark, measure, or membership vector.

assortativity

Which method to use for ⁠*_homophily()⁠. Either "ie" (negative E-I index), "ei" (E-I index), "yule" (Yule's Q), "geary" (Geary's C), or "moran" (Moran's I). Default is "ie". The first three are for categorical attributes, and the last two for numeric attributes. The E-I index is the number of ties between (or external) nodes grouped in some mutually exclusive categories minus the number of ties within (or internal) these groups divided by the total number of ties. This value can range from 1 to -1, where 1 indicates ties only between categories/groups and -1 ties only within categories/groups.

Yule's Q is a measure of association for two binary variables, calculated as:

Q=ad−bcad+bcQ = \frac{ad - bc}{ad + bc}

where aa is the number of ties between nodes in the same category, bb is the number of ties between nodes in different categories, cc is the number of non-ties between nodes in the same category, and dd is the number of non-ties between nodes in different categories. This value can range from -1 to 1, where 1 indicates perfect association (all ties are between nodes in the same category), -1 indicates perfect disassociation (all ties are between nodes in different categories), and 0 indicates no association.

Geary's C is a measure of spatial autocorrelation, calculated as:

C=(n−1)∑i=1n∑j=1nwij(xi−xj)22W∑i=1n(xi−xˉ)2C = \frac{(n - 1) \sum \limits_{i=1}^n \sum\limits_{j=1}^n w_{ij} (x_i - x_j)^2}{2W \sum\limits_{i=1}^n (x_i - \bar{x})^2}

where nn is the number of nodes, wijw_{ij} is the weight of the tie between nodes ii and jj, xix_i is the attribute value of node ii, xˉ\bar{x} is the mean attribute value across all nodes, and WW is the sum of all tie weights. This value can range from 0 to 2, where values less than 1 indicate positive autocorrelation (similar values are more likely to be connected), values greater than 1 indicate negative autocorrelation (dissimilar values are more likely to be connected), and a value of 1 indicates no autocorrelation. The upper bound of 2 holds where every tie carries the same weight. Geary's C reads the weights where the network has them, and a heavy tie between dissimilar values can then carry the sum past 2, so a weighted network declares the upper end open.

Moran's I is a measure of spatial autocorrelation, calculated as:

I=nW∑i=1n∑j=1nwij(xi−xˉ)(xj−xˉ)∑i=1n(xi−xˉ)2I = \frac{n}{W} \frac{\sum\limits_{i=1}^n \sum\limits_{j=1}^n w_{ij} (x_i - \bar{x})(x_j - \bar{x})}{\sum\limits_{i=1}^n (x_i - \bar{x})^2}

with the same terms as Geary's C. Positive values indicate that tied nodes hold similar values, and negative values that they hold dissimilar ones, so it runs the same way as the "ie" index, and the other way to Geary's C. See the section on spatial autocorrelation for its range. If an incompatible method is chosen for the attribute type, a suitable alternative will be used instead with a message.

Value

A node_measure numeric vector the length of the nodes in the network, providing the scores for each node. If the network is labelled, then the scores will be labelled with the nodes' names.

The object also carries the measure it computed, the range its values can fall within, and whether and how those values were normalized. These are shown as a one-line header when the object is printed. Where a measure offers a choice between several ways of counting the same thing, it also carries the variant it used. All can be retrieved with attr().

References

On local spatial autocorrelation

Anselin, Luc. 1995. "Local indicators of spatial association—LISA". Geographical Analysis 27(2): 93-115. doi:10.1111/j.1538-4632.1995.tb00338.x

See Also

Other diversity: measure_assort_net, measure_diverse_net, measure_diverse_node, measure_diverse_tie, motif_composition, motif_homophily

Other measures: measure_accuracy_net, measure_accuracy_node, measure_assort_net, measure_breadth, measure_broker_node, measure_broker_tie, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_central_tie_between, measure_central_tie_close, measure_central_tie_degree, measure_central_tie_eigen, measure_closure, measure_closure_node, measure_cohesion, measure_core, measure_diffusion_infection, measure_diffusion_net, measure_diffusion_node, measure_diverse_net, measure_diverse_node, measure_diverse_tie, measure_features, measure_fit, measure_fragmentation, measure_hierarchy, measure_periods

Other nodal: mark_core, mark_degree, mark_diff, mark_nodes, mark_select_node, measure_accuracy_node, measure_broker_node, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_closure_node, measure_core, measure_diffusion_node, measure_diverse_node, member_brokerage, member_cliques, member_community, member_community_hier, member_community_modular, member_community_partition, member_community_spread, member_components, member_core, member_diffusion, member_equivalence, motif_accuracy_node, motif_brokerage_node, motif_clique, motif_composition, motif_exposure, motif_node, motif_path

Examples

marvel_friends <- to_unsigned(to_uniplex(fict_marvel, "relationship"), "positive")
node_by_heterophily(marvel_friends, "Gender")
node_by_heterophily(marvel_friends, "Attractive")

Measures of network breadth

Description

These functions return values or vectors relating to how broad a network is.

  • net_by_diameter() measures the maximum path length in the network.

  • net_by_length() measures the average path length in the network.

Usage

net_by_diameter(.data)

net_by_length(.data)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

Details

For signed networks, both measures consider only the positive ties. They count path lengths, and a negative tie is hostility rather than a channel along which cohesion travels. Use manynet::to_unsigned() first to control this yourself. Dropping the negative ties can disconnect the network, in which case the measure covers the reachable pairs only.

Value

A network_measure numeric score.

The object also carries the measure it computed, the range its values can fall within, and whether and how those values were normalized. These are shown as a one-line header when the object is printed. Where a measure offers a choice between several ways of counting the same thing, it also carries the variant it used. All can be retrieved with attr().

See Also

Other cohesion: mark_triangles, measure_cohesion, measure_fragmentation, motif_net, motif_node

Other measures: measure_accuracy_net, measure_accuracy_node, measure_assort_net, measure_assort_node, measure_broker_node, measure_broker_tie, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_central_tie_between, measure_central_tie_close, measure_central_tie_degree, measure_central_tie_eigen, measure_closure, measure_closure_node, measure_cohesion, measure_core, measure_diffusion_infection, measure_diffusion_net, measure_diffusion_node, measure_diverse_net, measure_diverse_node, measure_diverse_tie, measure_features, measure_fit, measure_fragmentation, measure_hierarchy, measure_periods

Examples

net_by_diameter(fict_marvel)
net_by_diameter(to_giant(fict_marvel))
net_by_length(fict_marvel)
net_by_length(to_giant(fict_marvel))

Measures of node brokerage

Description

These function provide different measures of the degree to which nodes fill structural holes, as outlined in Burt (1992):

  • node_by_bridges() measures the sum of bridges to which each node is adjacent.

  • node_by_redundancy() measures the redundancy of each nodes' contacts.

  • node_by_effsize() measures nodes' effective size.

  • node_by_efficiency() measures nodes' efficiency.

  • node_by_constraint() measures nodes' constraint scores for one-mode networks according to Burt (1992) and for two-mode networks according to Hollway et al (2020).

  • node_by_hierarchy() measures nodes' exposure to hierarchy, where only one or two contacts are the source of closure.

  • node_by_neighbours_degree() measures nodes' average nearest neighbors degree, or knnknn, a measure of the type of local environment a node finds itself in

Burt's theory holds that while those nodes embedded in dense clusters of close connections are likely exposed to the same or similar ideas and information, those who fill structural holes between two otherwise disconnected groups can gain some comparative advantage from that position.

Usage

node_by_bridges(.data)

node_by_redundancy(.data)

node_by_effsize(.data)

node_by_efficiency(.data)

node_by_constraint(.data)

node_by_hierarchy(.data)

node_by_neighbours_degree(.data)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

Details

A number of different ways of measuring these structural holes are available. Note that we use Borgatti's reformulation for unweighted networks in node_redundancy() and node_effsize(). Redundancy is thus 2tn\frac{2t}{n}, where tt is the sum of ties and nn the sum of nodes in each node's neighbourhood, and effective size is calculated as n−2tnn - \frac{2t}{n}. Node efficiency is the node's effective size divided by its degree.

For multilevel networks, node_by_effsize() and node_by_efficiency() measure the network whole, as net_by_independence() does. A multilevel network reports itself as two-mode, but holds ties within a mode as well as between them, so it cannot be projected onto one mode. The projection remains for genuine two-mode networks.

Value

A node_measure numeric vector the length of the nodes in the network, providing the scores for each node. If the network is labelled, then the scores will be labelled with the nodes' names.

The object also carries the measure it computed, the range its values can fall within, and whether and how those values were normalized. These are shown as a one-line header when the object is printed. Where a measure offers a choice between several ways of counting the same thing, it also carries the variant it used. All can be retrieved with attr().

Constraint

Constraint has a natural floor at 0, for a node whose contacts are wholly unconnected to one another, but no clean ceiling: the standard result is that it can reach around 1.125 for one-mode networks, and the two-mode form is a different summation again. Its declared range is therefore left open above rather than asserting a bound the measure can exceed.

References

On structural holes

Burt, Ronald S. 1992. Structural Holes: The Social Structure of Competition. Cambridge, MA: Harvard University Press.

Borgatti, Steven. 1997. “Structural Holes: Unpacking Burt’s Redundancy Measures” Connections 20(1):35-38.

Burchard, Jake, and Benjamin Cornwell. 2018. “Structural Holes and Bridging in Two-Mode Networks.” Social Networks 55:11–20. doi:10.1016/j.socnet.2018.04.001

Hollway, James, Jean-Frédéric Morin, and Joost Pauwelyn. 2020. "Structural conditions for novelty: The introduction of new environmental clauses to the trade regime complex." International Environmental Agreements: Politics, Law and Economics 20 (1): 61–83. doi:10.1007/s10784-019-09464-5

On neighbours average degree

Barrat, Alain, Marc Barthelemy, Romualdo Pastor-Satorras, and Alessandro Vespignani. 2004. "The architecture of complex weighted networks", Proc. Natl. Acad. Sci. 101: 3747.

See Also

Other brokerage: measure_broker_tie, measure_brokerage, member_brokerage, motif_brokerage_net, motif_brokerage_node

Other measures: measure_accuracy_net, measure_accuracy_node, measure_assort_net, measure_assort_node, measure_breadth, measure_broker_tie, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_central_tie_between, measure_central_tie_close, measure_central_tie_degree, measure_central_tie_eigen, measure_closure, measure_closure_node, measure_cohesion, measure_core, measure_diffusion_infection, measure_diffusion_net, measure_diffusion_node, measure_diverse_net, measure_diverse_node, measure_diverse_tie, measure_features, measure_fit, measure_fragmentation, measure_hierarchy, measure_periods

Other nodal: mark_core, mark_degree, mark_diff, mark_nodes, mark_select_node, measure_accuracy_node, measure_assort_node, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_closure_node, measure_core, measure_diffusion_node, measure_diverse_node, member_brokerage, member_cliques, member_community, member_community_hier, member_community_modular, member_community_partition, member_community_spread, member_components, member_core, member_diffusion, member_equivalence, motif_accuracy_node, motif_brokerage_node, motif_clique, motif_composition, motif_exposure, motif_node, motif_path

Examples

node_by_bridges(ison_adolescents)
node_by_bridges(ison_southern_women)
node_by_redundancy(ison_adolescents)
node_by_redundancy(ison_southern_women)
node_by_effsize(ison_adolescents)
node_by_effsize(ison_southern_women)
node_by_efficiency(ison_adolescents)
node_by_efficiency(ison_southern_women)
node_by_constraint(ison_southern_women)
node_by_hierarchy(ison_adolescents)
node_by_hierarchy(ison_southern_women)

Measures of tie brokerage

Description

tie_by_cohesion() measures the ratio between common neighbors to ties' adjacent nodes and the total number of adjacent nodes, where high values indicate ties' embeddedness in dense local environments.

A tie whose two endpoints have no other neighbours has nothing to be embedded in, and so returns NaN rather than 0.

Usage

tie_by_cohesion(.data)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

Value

A tie_measure numeric vector the length of the ties in the network, providing the scores for each tie. If the network is labelled, then the scores will be labelled with the ties' adjacent nodes' names.

The object also carries the measure it computed, the range its values can fall within, and whether and how those values were normalized. These are shown as a one-line header when the object is printed. Where a measure offers a choice between several ways of counting the same thing, it also carries the variant it used. All can be retrieved with attr().

See Also

Other brokerage: measure_broker_node, measure_brokerage, member_brokerage, motif_brokerage_net, motif_brokerage_node

Other measures: measure_accuracy_net, measure_accuracy_node, measure_assort_net, measure_assort_node, measure_breadth, measure_broker_node, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_central_tie_between, measure_central_tie_close, measure_central_tie_degree, measure_central_tie_eigen, measure_closure, measure_closure_node, measure_cohesion, measure_core, measure_diffusion_infection, measure_diffusion_net, measure_diffusion_node, measure_diverse_net, measure_diverse_node, measure_diverse_tie, measure_features, measure_fit, measure_fragmentation, measure_hierarchy, measure_periods

Other tie: mark_dyads, mark_select_tie, mark_ties, mark_triangles, measure_central_tie_between, measure_central_tie_close, measure_central_tie_degree, measure_central_tie_eigen, measure_diverse_tie, member_community_link

Examples

tie_by_cohesion(ison_adolescents)

Measures of brokerage

Description

These functions include ways to measure nodes' brokerage activity and exclusivity in a network:

  • node_by_brokering_activity() measures nodes' brokerage activity.

  • node_by_brokering_exclusivity() measures nodes' brokerage exclusivity.

Usage

node_by_brokering_activity(.data, membership)

node_by_brokering_exclusivity(.data, membership)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

membership

A character string naming an existing node attribute in the network, or a categorical vector of the same length as the number of nodes in the network where each element indicates the group membership of the corresponding node. While this may often be a vector created using ⁠node_in_*()⁠ functions, it can be any character vector that assigns nodes to groups or categories.

Value

A node_measure numeric vector the length of the nodes in the network, providing the scores for each node. If the network is labelled, then the scores will be labelled with the nodes' names.

The object also carries the measure it computed, the range its values can fall within, and whether and how those values were normalized. These are shown as a one-line header when the object is printed. Where a measure offers a choice between several ways of counting the same thing, it also carries the variant it used. All can be retrieved with attr().

References

On brokerage activity and exclusivity

Hamilton, Matthew, Jacob Hileman, and Orjan Bodin. 2020. "Evaluating heterogeneous brokerage: New conceptual and methodological approaches and their application to multi-level environmental governance networks" Social Networks 61: 1-10. doi:10.1016/j.socnet.2019.08.002

See Also

Other measures: measure_accuracy_net, measure_accuracy_node, measure_assort_net, measure_assort_node, measure_breadth, measure_broker_node, measure_broker_tie, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_central_tie_between, measure_central_tie_close, measure_central_tie_degree, measure_central_tie_eigen, measure_closure, measure_closure_node, measure_cohesion, measure_core, measure_diffusion_infection, measure_diffusion_net, measure_diffusion_node, measure_diverse_net, measure_diverse_node, measure_diverse_tie, measure_features, measure_fit, measure_fragmentation, measure_hierarchy, measure_periods

Other nodal: mark_core, mark_degree, mark_diff, mark_nodes, mark_select_node, measure_accuracy_node, measure_assort_node, measure_broker_node, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_closure_node, measure_core, measure_diffusion_node, measure_diverse_node, member_brokerage, member_cliques, member_community, member_community_hier, member_community_modular, member_community_partition, member_community_spread, member_components, member_core, member_diffusion, member_equivalence, motif_accuracy_node, motif_brokerage_node, motif_clique, motif_composition, motif_exposure, motif_node, motif_path

Other brokerage: measure_broker_node, measure_broker_tie, member_brokerage, motif_brokerage_net, motif_brokerage_node

Examples

node_by_brokering_exclusivity(ison_networkers, "Discipline")

Measures of node betweenness-like centrality

Description

These functions calculate common betweenness-related centrality measures for one- and two-mode networks:

  • node_by_betweenness() measures the betweenness centralities of nodes in a network.

  • node_by_induced() measures the induced betweenness centralities of nodes in a network.

  • node_by_flow() measures the flow betweenness centralities of nodes in a network, which uses the maximum flow that the ties can carry between other nodes in contrast to the shortest paths model used by normal betweenness centrality. Given from or to, it instead measures the maximum flow between that node and each other node.

  • node_by_stress() measures the stress centrality of nodes in a network.

These four differ in what they count: node_by_betweenness() sums the proportion of shortest paths between each pair that run through a node, so every pair of nodes contributes at most one unit however many shortest paths connect it; node_by_stress() instead sums the raw count of those paths, so pairs joined by many equally short routes count for more; node_by_flow() abandons shortest paths altogether for maximum flow, crediting nodes that carry traffic along longer routes as well; and node_by_induced() asks a different question again — not how much passes through a node, but how much total betweenness the network would lose if it were removed. For ties rather than nodes, see tie_by_betweenness().

All measures attempt to use as much information as they are offered, including whether the networks are directed, weighted, or multimodal. If this would produce unintended results, first transform the salient properties using e.g. to_undirected() functions. All centrality and centralization measures return normalised or scaled measures where available, reported when the measure is printed.

Usage

node_by_betweenness(.data, normalized = TRUE, cutoff = NULL)

node_by_induced(.data, normalized = TRUE, cutoff = NULL)

node_by_flow(.data, from, to, normalized = TRUE)

node_by_stress(.data, normalized = TRUE)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

normalized

Logical scalar, whether scores are normalized. Different denominators may be used depending on the measure, whether the object is one-mode or two-mode, and other arguments. By default TRUE.

cutoff

The maximum path length to consider when calculating betweenness. If negative or NULL (the default), there's no limit to the path lengths considered.

from, to

Index or name of a node to measure the maximum flow from or to. If neither is given (the default), node_by_flow() returns flow betweenness centrality.

Details

For signed networks, these measures consider only the positive ties, and say so. They read a tie as a distance, and a negative tie is hostility rather than a channel along which cohesion travels. Use manynet::to_unsigned() first to control this yourself.

Value

A node_measure numeric vector the length of the nodes in the network, providing the scores for each node. If the network is labelled, then the scores will be labelled with the nodes' names.

The object also carries the measure it computed, the range its values can fall within, and whether and how those values were normalized. These are shown as a one-line header when the object is printed. Where a measure offers a choice between several ways of counting the same thing, it also carries the variant it used. All can be retrieved with attr().

Betweenness centrality

Betweenness centrality is based on the number of shortest paths between other nodes that a node lies upon:

CB(i)=∑j,k:j≠k,j≠i,k≠igjikgjkC_B(i) = \sum_{j,k:j \neq k, j \neq i, k \neq i} \frac{g_{jik}}{g_{jk}}

Setting cutoff counts only those shortest paths no longer than kk, which elsewhere goes by distance-bounded betweenness (Brandes, 2008) or range-limited betweenness (Ercsey-Ravasz et al., 2012). Normalization still applies, so a bounded score remains comparable across networks.

Induced centrality

Induced centrality concerns the change in total betweenness centrality between networks with and without a given node:

CI(i)=CB(G)−CB(G i)C_I(i) = C_B(G) - C_B(G\ i)

This "remove the node and re-measure" logic is the general delta centrality framework of Latora and Marchiori (2007); node_by_induced() is its betweenness instance, and node_by_vitality() its closeness instance.

Flow betweenness centrality

Flow betweenness centrality concerns the total maximum flow, ff, between other nodes j,kj,k in a network GG that a given node mediates:

CF(i)=∑j,k:j≠k,j≠i,k≠if(j,k,G)−f(j,k,G i)C_F(i) = \sum_{j,k:j\neq k, j\neq i, k\neq i} f(j,k,G) - f(j,k,G\ i)

When normalized (by default) this sum of differences is divided by the sum of flows f(i,j,G)f(i,j,G).

Maximum flow

Given from or to, node_by_flow() is not a centrality index but a flow query, as node_by_distance() is a distance query: it reports the maximum flow f(i,j,G)f(i,j,G) that the ties can carry from the named node to each other node (or to the named node from each other). By the max-flow min-cut theorem this is also the smallest total capacity of ties that would need to be removed to separate the two nodes. Flow betweenness is built from this quantity: maximum flow says how much can pass between two nodes, and flow betweenness how much of what passes between others depends on a third. The named node has no flow to itself, and so is NA. When normalized (by default) each flow is divided by the most that could leave its source or enter its target, the smaller of the source's out-strength and the target's in-strength. The smallest maximum flow between any two nodes in a network is its tie connectivity; see net_by_adhesion().

For weighted networks, node_by_flow() reads a tie's weight as its capacity: how much the tie can carry, so that a heavier tie carries more. Note that this is the reverse of the shortest-path measures documented here, which read a weight as a distance. An unweighted tie has a capacity of one. Use manynet::to_unweighted() first to treat all ties alike.

Stress centrality

Stress centrality is the number of all shortest paths or geodesics, gg, between other nodes that a given node mediates:

CS(i)=∑j,k:j≠k,j≠i,k≠igjikC_S(i) = \sum_{j,k:j \neq k, j \neq i, k \neq i} g_{jik}

High stress nodes lie on a large number of shortest paths between other nodes, and thus associated with bridging or spanning boundaries.

References

On betweenness centrality

Freeman, Linton. 1977. "A set of measures of centrality based on betweenness". Sociometry, 40(1): 35–41. doi:10.2307/3033543

On bounding path length

Brandes, Ulrik. 2008. "On variants of shortest-path betweenness centrality and their generic computation". Social Networks 30(2): 136-145. doi:10.1016/j.socnet.2007.11.001

Ercsey-Ravasz, Maria, Ryan N. Lichtenwalter, Nitesh V. Chawla, and Zoltan Toroczkai. 2012. "Range-limited centrality measures in complex networks". Physical Review E 85(6): 066103. doi:10.1103/PhysRevE.85.066103

On induced centrality

Everett, Martin and Steve Borgatti. 2010. "Induced, endogenous and exogenous centrality" Social Networks, 32: 339-344. doi:10.1016/j.socnet.2010.06.004

On delta centrality

Latora, Vito, and Massimo Marchiori. 2007. "A measure of centrality based on network efficiency". New Journal of Physics 9(6): 188. doi:10.1088/1367-2630/9/6/188

On flow centrality

Freeman, Linton C., Stephen P. Borgatti, and Douglas R. White. 1991. "Centrality in Valued Graphs: A Measure of Betweenness Based on Network Flow". Social Networks, 13(2), 141-154. doi:10.1016/0378-8733(91)90017-N

Koschutzki, D., K.A. Lehmann, L. Peeters, S. Richter, D. Tenfelde-Podehl, and O. Zlotowski. 2005. "Centrality Indices". In U. Brandes and T. Erlebach (eds.), Network Analysis: Methodological Foundations. Berlin: Springer.

On maximum flow

Ford, Lester R., and Delbert R. Fulkerson. 1956. "Maximal flow through a network". Canadian Journal of Mathematics, 8: 399-404. doi:10.4153/CJM-1956-045-5

On stress centrality

Shimbel, A. 1953. "Structural Parameters of Communication Networks". Bulletin of Mathematical Biophysics, 15:501-507. doi:10.1007/BF02476438

See Also

Other betweenness: measure_central_tie_between, measure_centralisation_between

Other centrality: measure_central_close, measure_central_degree, measure_central_eigen, measure_central_tie_between, measure_central_tie_close, measure_central_tie_degree, measure_central_tie_eigen, measure_centralisation_between, measure_centralisation_close, measure_centralisation_degree, measure_centralisation_eigen

Other measures: measure_accuracy_net, measure_accuracy_node, measure_assort_net, measure_assort_node, measure_breadth, measure_broker_node, measure_broker_tie, measure_brokerage, measure_central_close, measure_central_degree, measure_central_eigen, measure_central_tie_between, measure_central_tie_close, measure_central_tie_degree, measure_central_tie_eigen, measure_closure, measure_closure_node, measure_cohesion, measure_core, measure_diffusion_infection, measure_diffusion_net, measure_diffusion_node, measure_diverse_net, measure_diverse_node, measure_diverse_tie, measure_features, measure_fit, measure_fragmentation, measure_hierarchy, measure_periods

Other nodal: mark_core, mark_degree, mark_diff, mark_nodes, mark_select_node, measure_accuracy_node, measure_assort_node, measure_broker_node, measure_brokerage, measure_central_close, measure_central_degree, measure_central_eigen, measure_closure_node, measure_core, measure_diffusion_node, measure_diverse_node, member_brokerage, member_cliques, member_community, member_community_hier, member_community_modular, member_community_partition, member_community_spread, member_components, member_core, member_diffusion, member_equivalence, motif_accuracy_node, motif_brokerage_node, motif_clique, motif_composition, motif_exposure, motif_node, motif_path

Examples

node_by_betweenness(ison_southern_women)
node_by_induced(ison_adolescents)
node_by_flow(ison_adolescents)
node_by_flow(ison_adolescents, from = 1, normalized = FALSE)

Measures of node closeness-like centrality

Description

These functions calculate common closeness-related centrality measures that rely on path-length for one- and two-mode networks:

  • node_by_closeness() measures the closeness centrality of nodes in a network.

  • node_by_harmonic() measures nodes' harmonic centrality or valued centrality, which is thought to behave better than reach centrality for disconnected networks.

  • node_by_reach() measures nodes' reach centrality, or how many nodes they can reach within k steps.

  • node_by_decay() measures nodes' decay centrality, a distance-weighted generalisation of reach centrality.

  • node_by_integration() measures nodes' integration or radiality, which weights alters by how close they are rather than counting them; node_by_radiality() returns the direction = 'out' results. Note that on a connected network integration ranks nodes identically to closeness centrality, of which it is an affine transformation; it differs only in how it treats unreachable nodes.

  • node_by_information() measures nodes' information centrality or current-flow closeness centrality.

  • node_by_eccentricity() measures nodes' eccentricity or maximum distance from another node in the network.

  • node_by_distance() measures nodes' geodesic distance from or to a given node.

  • node_by_vitality() measures a network's closeness vitality centrality, or the change in closeness centrality between networks with and without a given node.

  • node_by_randomwalk() measures nodes' random walk closeness centrality, or the inverse of the average time a random walk takes to reach them.

All measures attempt to use as much information as they are offered, including whether the networks are directed, weighted, or multimodal. If this would produce unintended results, first transform the salient properties using e.g. to_undirected() functions. All centrality and centralization measures return normalised or scaled measures where available, reported when the measure is printed. Most of these measures are normalised against a theoretical maximum, so that scores can be compared across networks; node_by_randomwalk() and node_by_distance() have no such maximum and are instead scaled against the largest value observed in this network.

Usage

node_by_closeness(
  .data,
  normalized = TRUE,
  direction = c("out", "in", "all"),
  cutoff = NULL
)

node_by_harmonic(
  .data,
  normalized = TRUE,
  cutoff = -1,
  decay = NULL,
  direction = c("out", "in")
)

node_by_reach(.data, normalized = TRUE, cutoff = 2)

node_by_decay(
  .data,
  normalized = TRUE,
  decay = 0.5,
  direction = c("out", "in")
)

node_by_integration(.data, normalized = TRUE, direction = c("in", "out"))

node_by_radiality(.data, normalized = TRUE)

node_by_information(.data, normalized = TRUE)

node_by_eccentricity(.data, normalized = TRUE)

node_by_distance(.data, from, to, normalized = TRUE)

node_by_vitality(.data, normalized = TRUE)

node_by_randomwalk(.data, normalized = TRUE)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

normalized

Logical scalar, whether scores are normalized. Different denominators may be used depending on the measure, whether the object is one-mode or two-mode, and other arguments. By default TRUE.

direction

Character string, “out” bases the measure on outgoing ties, “in” on incoming ties, and "all" on either/the sum of the two. By default "all".

cutoff

Integer scalar, the maximum path length considered. Paths longer than this are ignored, which restricts the measure to a node's local neighbourhood. Where a measure is defined over all paths by default, a negative value or NULL imposes no limit.

decay

A proportion between 0 and 1 giving how much of a contribution survives each additional step of distance or walk length. Lower values discount more steeply, so that only nearby others count; higher values discount less, so that longer walks continue to contribute. The measures that take a decay differ in what they discount and in what value leaves the measure in its most familiar form, so each documents its own default.

from, to

Index or name of a node to calculate distances from or to.

Details

For signed networks, these measures consider only the positive ties, and say so. They read a tie as a distance, and a negative tie is hostility rather than a channel along which cohesion travels. Use manynet::to_unsigned() first to control this yourself.

Value

A node_measure numeric vector the length of the nodes in the network, providing the scores for each node. If the network is labelled, then the scores will be labelled with the nodes' names.

The object also carries the measure it computed, the range its values can fall within, and whether and how those values were normalized. These are shown as a one-line header when the object is printed. Where a measure offers a choice between several ways of counting the same thing, it also carries the variant it used. All can be retrieved with attr().

Closeness centrality

Closeness centrality is also known as status centrality, barycenter centrality, or the Sabidussi index. It is defined as the reciprocal of the farness or distance, dd, from a node to all other nodes in the network:

CC(i)=1∑jd(i,j)C_C(i) = \frac{1}{\sum_j d(i,j)}

When (more commonly) normalised, the numerator is instead N−1N-1.

Harmonic centrality

Harmonic centrality or valued centrality reverses the sum and reciprocal operations compared to closeness centrality:

CH(i)=∑i,i≠j1d(i,j)C_H(i) = \sum_{i, i \neq j} \frac{1}{d(i,j)}

where 1d(i,j)=0\frac{1}{d(i,j)} = 0 where there is no path between ii and jj. Normalization is by N−1N-1. Since the harmonic mean performs better than the arithmetic mean on unconnected networks, i.e. networks with infinite distances, harmonic centrality is to be preferred in these cases.

Harmonic centrality sums a decreasing function of each distance, ∑jf(d(i,j))\sum_j f(d(i,j)), and setting decay simply swaps in a different such function, δd\delta^d, giving decay centrality (see below). Note that node_by_closeness() cannot be reached this way: it sums the distances and inverts once, 1/∑jd(i,j)1/\sum_j d(i,j), which is a different order of aggregation that no choice of decay function reproduces.

Reach centrality

In some cases, longer path lengths are irrelevant and 'closeness' should be defined as how many others are in a local neighbourhood. How many steps out this neighbourhood should be defined as is given by the 'cutoff' parameter. This is usually termed kk or mm in equations, which is why this is sometimes called (mm- or) kk-step reach centrality:

CR(i)=∑jd(i,j)≤kC_R(i) = \sum_j d(i,j) \leq k

The maximum reach score is N−1N-1, achieved when the node can reach all other nodes in the network in kk steps or less, but the normalised version, CRN−1\frac{C_R}{N-1}, is more common. Note that if k=1k = 1 (i.e. cutoff = 1), then this returns the node's degree. At higher cutoff reach centrality returns the size of the node's component. Counting the others reachable by a geodesic of length at most kk is also known as geodesic kk-path centrality (Borgatti and Everett, 2006); note that it is not the same as the kk-path indices that count paths rather than nodes.

Decay centrality

Here decay defaults to 0.5, so that each additional step halves a node's contribution. As it approaches 0 this approaches degree centrality, and as it approaches 1 the size of the node's component.

Where reach centrality counts how many others are within a fixed number of steps, decay centrality weights every reachable other by how far away they are, so that nearer nodes count for more:

CD(i)=∑j,j≠iδd(i,j)−1C_D(i) = \sum_{j, j \neq i} \delta^{d(i,j)-1}

where δ\delta is the decay parameter and unreachable nodes contribute nothing. This avoids having to choose a single cutoff, since the contribution of distant nodes tapers off smoothly rather than being truncated. Normalization is by N−1N-1, the score achieved when a node is adjacent to all others.

Integration and radiality

Integration centrality, also known as radiality, inverts the usual farness logic: instead of summing distances, it sums how much closer than the network's diameter each other node is:

CI(i)=∑j,j≠i(Δ−d(i,j)+1)C_I(i) = \sum_{j, j \neq i} (\Delta - d(i,j) + 1)

where Δ\Delta is the maximum finite distance in the network. Nodes that are near to many others therefore score highly, while unreachable pairs contribute nothing. Normalization is by (N−1)Δ(N-1)\Delta.

Valente and Foreman distinguish the two directions: integration is calculated on incoming ties, capturing how well a node is reached by others, whereas radiality is calculated on outgoing ties, capturing how well a node reaches others. Use direction to choose; in undirected networks they coincide.

Information centrality

Information centrality, also known as current-flow centrality, is a hybrid measure relating to both path-length and walk-based measures. The information centrality of a node is the harmonic average of the “bandwidth” or inverse path-length for all paths originating from the node.

As described in the {sna} package, information centrality works on an undirected but potentially weighted network excluding isolates (which take scores of zero). It is defined as:

CI=1T+∑T−2∑C1∣N∣C_I = \frac{1}{T + \frac{\sum T - 2 \sum C_1}{|N|}}

where C=B−1C = B^-1 with BB is a pseudo-adjacency matrix replacing the diagonal of 1−A1-A with 1+k1+k, and TT is the trace of CC and SRS_R an arbitrary row sum (all rows in CC have the same sum).

Nodes with higher information centrality have a large number of short paths to many others in the network, and are thus considered to have greater control of the flow of information.

Information centrality is the closeness-like member of the current-flow family; its betweenness-like counterpart is random walk (or current-flow) betweenness centrality, which netrics does not yet offer.

Eccentricity centrality

Eccentricity centrality, graph centrality, or the Koenig number, is the (if normalized, inverse of) the distance to the furthest node:

CE(i)=1maxj∈Nd(i,j)C_E(i) = \frac{1}{max_{j \in N} d(i,j)}

where the distance from ii to jj is ∞\infty if unconnected. As such it is only well defined for connected networks.

Geodesic distance

Unlike the other functions documented here, node_by_distance() is not a centrality index but a distance query: it reports each node's geodesic distance from (or to) one named node, rather than summarising its position with respect to the network as a whole. It is grouped here because the closeness-like centralities are all built from the same geodesic distances. A node that cannot be reached has an infinite distance, normalised or not. The scaled distances divide by the largest finite distance, so that the reachable nodes still fall within [0,1][0,1].

Closeness vitality centrality

The closeness vitality of a node is the change in the sum of all distances in a network, also known as the Wiener Index, when that node is removed. Since the Wiener Index of a disconnected network is infinite, the unnormalised closeness vitality of a cut node — one whose removal would disconnect the network — is negative infinity. This is a property of the definition rather than a failure of it: it picks out exactly the cut nodes. Because that is awkward to work with, the normalised version rescales the finite scores onto [0,1][0,1] and gives cut nodes a score of 0, the endpoint that negative infinity occupies. Formally:

CV(i)=∑j,kd(j,k)−∑j,kd(j,k,G i)C_V(i) = \sum_{j,k} d(j,k) - \sum_{j,k} d(j,k,G\ i)

where d(j,k,G i)d(j,k,G\ i) is the distance between nodes jj and kk in the network with node ii removed. This is the closeness instance of the delta centrality framework; for its betweenness instance see node_by_induced().

Random walk closeness centrality

Random walk closeness centrality is based on the average length of random walks starting at all other nodes to reach a given node. It is defined as the inverse of the average hitting time to a node. This means that higher values are given to nodes that can be reached more quickly on average by random walks starting at other nodes. Formally:

CRW(i)=11N−1∑j≠iHjiC_{RW}(i) = \frac{1}{\frac{1}{N-1} \sum_{j \neq i} H_{ji}}

where HjiH_{ji} is the hitting time from node jj to node ii.

References

On closeness centrality

Sabidussi, Gert. 1966. "The centrality index of a graph". Psychometrika, 31(4): 581–603. doi:10.1007/BF02289527

Bavelas, Alex. 1950. "Communication Patterns in Task‐Oriented Groups". The Journal of the Acoustical Society of America, 22(6): 725–730. doi:10.1121/1.1906679

Harary, Frank. 1959. "Status and Contrastatus". Sociometry, 22(1): 23–43. doi:10.2307/2785610

On harmonic centrality

Marchiori, Massimo, and Vito Latora. 2000. "Harmony in the small-world". Physica A 285: 539-546. doi:10.1016/S0378-4371(00)00311-3

Dekker, Anthony. 2005. "Conceptual distance in social network analysis". Journal of Social Structure 6(3).

Boldi, Paolo, and Sebastiano Vigna. 2014. "Axioms for Centrality". Internet Mathematics 10(3-4): 222-262. doi:10.1080/15427951.2013.865686

On reach centrality

Borgatti, Stephen P., Martin G. Everett, and J.C. Johnson. 2013. Analyzing social networks. London: SAGE Publications Limited.

Borgatti, Stephen P., and Martin G. Everett. 2006. "A graph-theoretic perspective on centrality". Social Networks 28(4): 466-484. doi:10.1016/j.socnet.2005.11.005

On decay centrality

Jackson, Matthew O. 2008. Social and Economic Networks. Princeton: Princeton University Press.

On integration and radiality

Valente, Thomas W., and Robert K. Foreman. 1998. "Integration and radiality: Measuring the extent of an individual's connectedness and reachability in a network". Social Networks 20(1): 89-105. doi:10.1016/S0378-8733(97)00007-5

On information centrality

Stephenson, Karen, and Marvin Zelen. 1989. "Rethinking centrality: Methods and examples". Social Networks 11(1):1-37. doi:10.1016/0378-8733(89)90016-6

Brandes, Ulrik, and Daniel Fleischer. 2005. "Centrality Measures Based on Current Flow". Proc. 22nd Symp. Theoretical Aspects of Computer Science LNCS 3404: 533-544. doi:10.1007/978-3-540-31856-9_44

On eccentricity centrality

Hage, Per, and Frank Harary. 1995. "Eccentricity and centrality in networks". Social Networks, 17(1): 57-63. doi:10.1016/0378-8733(94)00248-9

On closeness vitality centrality

Koschuetzki, Dirk, Katharina Lehmann, Leon Peeters, Stefan Richter, Dagmar Tenfelde-Podehl, and Oliver Zlotowski. 2005. "Centrality Indices", in Brandes, Ulrik, and Thomas Erlebach (eds.). Network Analysis: Methodological Foundations. Springer: Berlin, pp. 16-61.

On random walk closeness centrality

Noh, J.D. and R. Rieger. 2004. "Random Walks on Complex Networks". Physical Review Letters, 92(11): 118701. doi:10.1103/PhysRevLett.92.118701

See Also

Other closeness: measure_central_tie_close, measure_centralisation_close

Other centrality: measure_central_between, measure_central_degree, measure_central_eigen, measure_central_tie_between, measure_central_tie_close, measure_central_tie_degree, measure_central_tie_eigen, measure_centralisation_between, measure_centralisation_close, measure_centralisation_degree, measure_centralisation_eigen

Other measures: measure_accuracy_net, measure_accuracy_node, measure_assort_net, measure_assort_node, measure_breadth, measure_broker_node, measure_broker_tie, measure_brokerage, measure_central_between, measure_central_degree, measure_central_eigen, measure_central_tie_between, measure_central_tie_close, measure_central_tie_degree, measure_central_tie_eigen, measure_closure, measure_closure_node, measure_cohesion, measure_core, measure_diffusion_infection, measure_diffusion_net, measure_diffusion_node, measure_diverse_net, measure_diverse_node, measure_diverse_tie, measure_features, measure_fit, measure_fragmentation, measure_hierarchy, measure_periods

Other nodal: mark_core, mark_degree, mark_diff, mark_nodes, mark_select_node, measure_accuracy_node, measure_assort_node, measure_broker_node, measure_brokerage, measure_central_between, measure_central_degree, measure_central_eigen, measure_closure_node, measure_core, measure_diffusion_node, measure_diverse_node, member_brokerage, member_cliques, member_community, member_community_hier, member_community_modular, member_community_partition, member_community_spread, member_components, member_core, member_diffusion, member_equivalence, motif_accuracy_node, motif_brokerage_node, motif_clique, motif_composition, motif_exposure, motif_node, motif_path

Examples

node_by_closeness(ison_southern_women)
node_by_reach(ison_adolescents)
node_by_decay(ison_adolescents)
node_by_integration(ison_adolescents)
node_by_radiality(ison_adolescents)

Measures of node degree-like centrality

Description

These functions calculate common degree-related centrality measures for one- and two-mode networks:

  • node_by_degree() measures the degree centrality of nodes in an unweighted network, or weighted degree/strength of nodes in a weighted network; there are several related shortcut functions:

    • node_by_deg() returns the unnormalised results.

    • node_by_indegree() returns the direction = 'in' results.

    • node_by_outdegree() returns the direction = 'out' results.

  • node_by_multidegree() measures the ratio between types of ties in a multiplex network.

  • node_by_leverage() measures the leverage centrality of nodes in a network.

All measures attempt to use as much information as they are offered, including whether the networks are directed, weighted, or multimodal. If this would produce unintended results, first transform the salient properties using e.g. manynet::to_undirected() functions. All centrality and centralization measures return normalised or scaled measures where available, reported when the measure is printed. Note that a weighted network has no theoretical maximum degree, so node_by_degree() there returns scaled rather than normalised scores, which rank nodes within this network but are not comparable with those of another.

node_by_multidegree() is the one measure here that is not reached by dispatch: a multiplex network does not itself say which two types of tie to contrast, so tie1 and tie2 must be named.

Usage

node_by_degree(
  .data,
  normalized = TRUE,
  alpha = 0,
  direction = c("all", "out", "in")
)

node_by_deg(.data, alpha = 0, direction = c("all", "out", "in"))

node_by_outdegree(.data, normalized = TRUE, alpha = 0)

node_by_indegree(.data, normalized = TRUE, alpha = 0)

node_by_multidegree(.data, tie1, tie2)

node_by_leverage(.data)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

normalized

Logical scalar, whether scores are normalized. Different denominators may be used depending on the measure, whether the object is one-mode or two-mode, and other arguments. By default TRUE.

alpha

Numeric scalar, the positive tuning parameter introduced in Opsahl et al (2010) for trading off between degree and strength centrality measures. By default, alpha = 0, which ignores tie weights and the measure is solely based upon degree (the number of ties). alpha = 1 ignores the number of ties and provides the sum of the tie weights as strength centrality. Values between 0 and 1 reflect different trade-offs in the relative contributions of degree and strength to the final outcome, with 0.5 as the middle ground. Values above 1 penalise for the number of ties. Of two nodes with the same sum of tie weights, the node with fewer ties will obtain the higher score. This argument is ignored except in the case of a weighted network.

direction

Character string, “out” bases the measure on outgoing ties, “in” on incoming ties, and "all" on either/the sum of the two. By default "all".

tie1

Character string indicating the first uniplex network.

tie2

Character string indicating the second uniplex network.

Value

A node_measure numeric vector the length of the nodes in the network, providing the scores for each node. If the network is labelled, then the scores will be labelled with the nodes' names.

The object also carries the measure it computed, the range its values can fall within, and whether and how those values were normalized. These are shown as a one-line header when the object is printed. Where a measure offers a choice between several ways of counting the same thing, it also carries the variant it used. All can be retrieved with attr().

Degree centrality

The degree of a node is the number of connections it has. It is also sometimes called the valency of a node, d(v)d(v). The maximum degree in a network is often denoted Δ(G)\Delta (G) and the minimum degree in a network δ(G)\delta (G). The total degree of a network is the sum of all degrees, ∑vd(v)\sum_v d(v). The degree sequence is the set of all nodes' degrees, ordered from largest to smallest. Directed networks discriminate between outdegree (degree of outgoing ties) and indegree (degree of incoming ties).

For multiplex networks, node_by_degree() counts every tie a node holds, whatever its layer, so a node tied twice to the same alter on two layers scores 2. To score one layer at a time, take it first with manynet::to_uniplex(), or use node_by_multidegree() to contrast two. Note that to_uniplex() drops the nodes that hold none of the retained ties, so scores from two layers are of different lengths.

Strength centrality

Given a weighted network, node_by_degree() sums tie weights rather than counting ties, which is also known as strength centrality or weighted degree centrality. The alpha argument tunes between the two, following Opsahl et al. (2010), and the measure reports itself as "strength centrality" whenever alpha is not zero.

Leverage centrality

Leverage centrality concerns the degree of a node compared with that of its neighbours, JJ:

CL(i)=1d(i)∑j∈J(i)d(i)−d(j)d(i)+d(j)C_L(i) = \frac{1}{d(i)} \sum_{j \in J(i)} \frac{d(i) - d(j)}{d(i) + d(j)}

References

On degree centrality

Freeman, Linton C. 1978. "Centrality in social networks: Conceptual clarification". Social Networks 1(3): 215-239. doi:10.1016/0378-8733(78)90021-7

On multimodal centrality

Faust, Katherine. 1997. "Centrality in affiliation networks." Social Networks 19(2): 157-191. doi:10.1016/S0378-8733(96)00300-0

Borgatti, Stephen P., and Martin G. Everett. 1997. "Network analysis of 2-mode data." Social Networks 19(3): 243-270. doi:10.1016/S0378-8733(96)00301-2

Borgatti, Stephen P., and Daniel S. Halgin. 2011. "Analyzing affiliation networks." In The SAGE Handbook of Social Network Analysis, edited by John Scott and Peter J. Carrington, 417–33. London, UK: Sage. doi:10.4135/9781446294413.n28

On strength centrality

Opsahl, Tore, Filip Agneessens, and John Skvoretz. 2010. "Node centrality in weighted networks: Generalizing degree and shortest paths." Social Networks 32, 245-251. doi:10.1016/j.socnet.2010.03.006

On leverage centrality

Joyce, Karen E., Paul J. Laurienti, Jonathan H. Burdette, and Satoru Hayasaka. 2010. "A New Measure of Centrality for Brain Networks". PLoS ONE 5(8): e12200. doi:10.1371/journal.pone.0012200

See Also

Other degree: mark_degree, measure_central_tie_degree, measure_centralisation_degree

Other centrality: measure_central_between, measure_central_close, measure_central_eigen, measure_central_tie_between, measure_central_tie_close, measure_central_tie_degree, measure_central_tie_eigen, measure_centralisation_between, measure_centralisation_close, measure_centralisation_degree, measure_centralisation_eigen

Other measures: measure_accuracy_net, measure_accuracy_node, measure_assort_net, measure_assort_node, measure_breadth, measure_broker_node, measure_broker_tie, measure_brokerage, measure_central_between, measure_central_close, measure_central_eigen, measure_central_tie_between, measure_central_tie_close, measure_central_tie_degree, measure_central_tie_eigen, measure_closure, measure_closure_node, measure_cohesion, measure_core, measure_diffusion_infection, measure_diffusion_net, measure_diffusion_node, measure_diverse_net, measure_diverse_node, measure_diverse_tie, measure_features, measure_fit, measure_fragmentation, measure_hierarchy, measure_periods

Other nodal: mark_core, mark_degree, mark_diff, mark_nodes, mark_select_node, measure_accuracy_node, measure_assort_node, measure_broker_node, measure_brokerage, measure_central_between, measure_central_close, measure_central_eigen, measure_closure_node, measure_core, measure_diffusion_node, measure_diverse_node, member_brokerage, member_cliques, member_community, member_community_hier, member_community_modular, member_community_partition, member_community_spread, member_components, member_core, member_diffusion, member_equivalence, motif_accuracy_node, motif_brokerage_node, motif_clique, motif_composition, motif_exposure, motif_node, motif_path

Examples

node_by_degree(ison_southern_women)

Measures of node eigenvector-like centrality

Description

These functions calculate common eigenvector-related centrality measures, or walk-based eigenmeasures, for one- and two-mode networks:

  • node_by_eigenvector() measures the eigenvector centrality of nodes in a network.

  • node_by_power() measures the Bonacich, beta, or power centrality of nodes in a network.

  • node_by_alpha() measures the alpha or Katz centrality of nodes in a network.

  • node_by_pagerank() measures the pagerank centrality of nodes in a network.

  • node_by_hub() measures how well nodes in a network serve as hubs pointing to many authorities.

  • node_by_authority() measures how well nodes in a network serve as authorities from many hubs.

  • node_by_subgraph() measures nodes' participation in all closed walks in the network, weighting shorter walks more heavily.

  • node_by_posneg() measures the PN (positive-negative) centrality of a signed network.

All measures attempt to use as much information as they are offered, including whether the networks are directed, weighted, or multimodal. If this would produce unintended results, first transform the salient properties using e.g. to_undirected() functions. All centrality and centralization measures return normalised or scaled measures where available, reported when the measure is printed.

Walk-based measures are mostly unbounded, so few of them can be normalised against a theoretical maximum in the way that degree, closeness and betweenness can. Most are instead scaled against the observed maximum, which ranks nodes within one network but does not give scores that are comparable between networks.

Usage

node_by_eigenvector(.data, normalized = TRUE, scaled = TRUE, scale = NULL)

node_by_power(
  .data,
  normalized = TRUE,
  scaled = FALSE,
  scale = NULL,
  exponent = 1
)

node_by_alpha(.data, decay = 0.85, alpha = NULL)

node_by_pagerank(.data, decay = 0.85)

node_by_authority(.data, scaled = TRUE)

node_by_hub(.data, scaled = TRUE)

node_by_subgraph(
  .data,
  decay = 1,
  walks = c("all", "odd", "even"),
  method = NULL
)

node_by_posneg(.data)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

normalized

Logical scalar, whether scores are normalized. Different denominators may be used depending on the measure, whether the object is one-mode or two-mode, and other arguments. By default TRUE.

scaled

Logical scalar, whether to divide the results by the maximum observed in this network, so that the highest-scoring node takes the value one. Note that, unlike normalisation against a theoretical maximum, scaled scores are not comparable across different networks.

scale

Deprecated; use scaled instead.

exponent

Decay rate or attentuation factor for the Bonacich power centrality score. Can be positive or negative.

decay

A proportion between 0 and 1 giving how much of a contribution survives each additional step of distance or walk length. Lower values discount more steeply, so that only nearby others count; higher values discount less, so that longer walks continue to contribute. The measures that take a decay differ in what they discount and in what value leaves the measure in its most familiar form, so each documents its own default.

alpha

Deprecated; use decay instead.

walks

Character string indicating which closed walks to count. By default "all", which is subgraph centrality as usually defined. "odd" counts only walks of odd length and "even" only those of even length; the two sum to "all". Odd closed walks cannot occur within a bipartite structure, so a node scoring near zero on "odd" sits in a locally two-mode-like neighbourhood. See net_by_bipartivity() for the network-level counterpart.

method

Deprecated. The former spelling of walks. Still accepted, but warns; please use walks instead.

Details

For signed networks, these measures read each tie by its magnitude, rather than drop the negative ties, since they do not read a tie as a distance. Use manynet::to_unsigned() first to control this yourself.

For multilevel networks, these measures score the network whole, as net_by_independence() does. A multilevel network reports itself as two-mode, but holds ties within a mode as well as between them, so it cannot be projected onto one mode. The projection remains for genuine two-mode networks, where no two nodes of one mode are ever tied.

We use {igraph} routines behind the scenes here for consistency and because they are often faster. For example, igraph::eigencentrality() is approximately 25% faster than sna::evcent().

Value

A node_measure numeric vector the length of the nodes in the network, providing the scores for each node. If the network is labelled, then the scores will be labelled with the nodes' names.

The object also carries the measure it computed, the range its values can fall within, and whether and how those values were normalized. These are shown as a one-line header when the object is printed. Where a measure offers a choice between several ways of counting the same thing, it also carries the variant it used. All can be retrieved with attr().

Eigenvector centrality

Eigenvector centrality operates as a measure of a node's influence in a network. The idea is that being connected to well-connected others results in a higher score. Each node's eigenvector centrality can be defined as:

xi=1λ∑j∈Nai,jxjx_i = \frac{1}{\lambda} \sum_{j \in N} a_{i,j} x_j

where ai,j=1a_{i,j} = 1 if ii is linked to jj and 0 otherwise, and λ\lambda is a constant representing the principal eigenvalue. Rather than performing this iteration, most routines solve the eigenvector equation Ax=λxAx = \lambda x. Note that since {igraph} v2.1.1, the values will always be rescaled so that the maximum is 1. This is not a limitation so much as a property of the measure: an eigenvector is defined only up to a scalar multiple, so its scores carry no absolute units to preserve.

Power or beta (or Bonacich) centrality

Power centrality includes an exponent that weights contributions to a node's centrality based on how far away those other nodes are.

cb(i)=∑A(i,j)(α=βc(j))c_b(i) = \sum A(i,j) (\alpha = \beta c(j))

Where β\beta is positive, this means being connected to central people increases centrality. Where β\beta is negative, this means being connected to central people decreases centrality (and being connected to more peripheral actors increases centrality). When β=0\beta = 0, this is the outdegree. α\alpha is calculated to make sure the root mean square equals the network size.

There is no solution where 1/β1/\beta is an eigenvalue of the network, as 1 is for any network with a separate pair of nodes, so node_by_power() stops there and says which exponents to use instead. An exponent whose absolute value is less than the inverse of the largest eigenvalue always has a solution.

Alpha centrality

Alpha centrality is also known as Katz centrality, Katz-Bonacich centrality, or Katz status. The measure is named for the α\alpha of Bonacich and Lloyd, which trades off the importance of external influence against the importance of connection: when α=0\alpha = 0 only the external influence matters, and as α\alpha grows only the connectivity matters and we reduce to eigenvector centrality. Since α\alpha is a per-step discount, netrics takes it as decay, the name it uses for that parameter throughout; by default 0.85. It operates better than eigenvector centrality for directed networks because eigenvector centrality will return 0s for all nodes not in the main strongly-connected component. Each node's alpha centrality can be defined as:

xi=1λ∑j∈Nai,jxj+eix_i = \frac{1}{\lambda} \sum_{j \in N} a_{i,j} x_j + e_i

where ai,j=1a_{i,j} = 1 if ii is linked to jj and 0 otherwise, λ\lambda is a constant representing the principal eigenvalue, and eie_i is some external influence used to ensure that even nodes beyond the main strongly connected component begin with some basic influence. Note that many equations replace 1λ\frac{1}{\lambda} with α\alpha, hence the name.

For example, if α=0.5\alpha = 0.5, then each direct connection (or alter) would be worth (0.5)1=0.5(0.5)^1 = 0.5, each secondary connection (or tertius) would be worth (0.5)2=0.25(0.5)^2 = 0.25, each tertiary connection would be worth (0.5)3=0.125(0.5)^3 = 0.125, and so on.

Rather than performing this iteration though, most routines solve the equation x=(I−1λAT)−1ex = (I - \frac{1}{\lambda} A^T)^{-1} e.

Pagerank centrality

Pagerank centrality, or the PageRank citation ranking, is the stationary distribution of a random walk that at each step either follows an outgoing tie or teleports to a node chosen at random. Scores are therefore already shares that sum to one. decay is the probability of following a tie rather than teleporting, elsewhere called the damping factor; by default 0.85. As it approaches 0 the walk teleports at every step and all nodes score alike; as it approaches 1 the walk never teleports.

Hub and authority centrality

Hub and authority centrality are the two halves of Kleinberg's HITS (Hyperlink-Induced Topic Search) algorithm, and are computed together: good authorities are pointed to by good hubs, and good hubs point to good authorities. node_by_hub() and node_by_authority() return one each. In an undirected network the two coincide.

Subgraph centrality

Subgraph centrality measures the participation of a node in all subgraphs in the network, giving higher weight to smaller subgraphs. It is defined as:

CS(i)=∑k=0∞δk(Ak)iik!C_S(i) = \sum_{k=0}^{\infty} \frac{\delta^k (A^k)_{ii}}{k!}

where (Ak)ii(A^k)_{ii} is the iith diagonal element of the kkth power of the adjacency matrix AA, representing the number of closed walks of length kk starting and ending at node ii. Weighting by 1k!\frac{1}{k!} ensures that shorter walks contribute more to the centrality score than longer walks. The decay parameter δ\delta tunes that further, discounting each step by a further factor: at the default of 1 the measure takes its usual form, and lower values concentrate it on ever shorter walks.

Subgraph centrality is a good choice of measure when the focus is on local connectivity and clustering around a node, as it captures the extent to which a node is embedded in tightly-knit groups within the network. Note though that because of the way spectral decomposition is used to calculate this measure, this is not a good measure for very large graphs.

Summing these scores over all nodes gives the network's Estrada index, so a node's subgraph centrality is its contribution to that index.

PN (positive-negative) centrality

PN centrality extends walk-based centrality to signed networks. Negative ties are weighted twice as heavily as positive ties, P−2NP - 2N, and the measure is then obtained in closed form by matrix inversion, so that — like alpha centrality, of which it is the signed analogue — it counts walks of all lengths with a length discount rather than counting only direct ties. Scores centre on 1: nodes above 1 are advantaged by their pattern of positive and negative ties, and those below 1 disadvantaged.

References

On eigenvector centrality

Bonacich, Phillip. 1972. “Factoring and Weighting Approaches to Status Scores and Clique Identification.” The Journal of Mathematical Sociology 2(1): 113–120. doi:10.1080/0022250X.1972.9989806

Bonacich, Phillip. 1991. “Simultaneous Group and Individual Centralities.” Social Networks 13(2):155–68. doi:10.1016/0378-8733(91)90018-O

On power centrality

Bonacich, Phillip. 1987. “Power and Centrality: A Family of Measures.” The American Journal of Sociology, 92(5): 1170–82. doi:10.1086/228631.

On alpha centrality

Katz, Leo 1953. "A new status index derived from sociometric analysis". Psychometrika. 18(1): 39–43.

Bonacich, P. and Lloyd, P. 2001. “Eigenvector-like measures of centrality for asymmetric relations” Social Networks. 23(3):191-201.

On pagerank centrality

Brin, Sergey and Page, Larry. 1998. "The anatomy of a large-scale hypertextual web search engine". Proceedings of the 7th World-Wide Web Conference. Brisbane, Australia.

Page, Lawrence, Sergey Brin, Rajeev Motwani, and Terry Winograd. 1999. "The PageRank Citation Ranking: Bringing Order to the Web". Stanford InfoLab Technical Report 1999-66.

On hub and authority centrality

Kleinberg, Jon. 1999. "Authoritative sources in a hyperlinked environment". Journal of the ACM 46(5): 604–632. doi:10.1145/324133.324140

On subgraph centrality

Estrada, Ernesto and Rodríguez-Velázquez, Juan A. 2005. "Subgraph centrality in complex networks". Physical Review E 71(5): 056103. doi:10.1103/PhysRevE.71.056103

On odd and even closed walks

Estrada, Ernesto and Rodríguez-Velázquez, Juan A. 2005. "Spectral measures of bipartivity in complex networks". Physical Review E 72(4): 046105. doi:10.1103/PhysRevE.72.046105

On signed centrality

Everett, Martin G., and Stephen P. Borgatti. 2014. “Networks Containing Negative Ties.” Social Networks 38:111–20. doi:10.1016/j.socnet.2014.03.005

See Also

Other eigenvector: measure_central_tie_eigen, measure_centralisation_eigen

Other centrality: measure_central_between, measure_central_close, measure_central_degree, measure_central_tie_between, measure_central_tie_close, measure_central_tie_degree, measure_central_tie_eigen, measure_centralisation_between, measure_centralisation_close, measure_centralisation_degree, measure_centralisation_eigen

Other measures: measure_accuracy_net, measure_accuracy_node, measure_assort_net, measure_assort_node, measure_breadth, measure_broker_node, measure_broker_tie, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_tie_between, measure_central_tie_close, measure_central_tie_degree, measure_central_tie_eigen, measure_closure, measure_closure_node, measure_cohesion, measure_core, measure_diffusion_infection, measure_diffusion_net, measure_diffusion_node, measure_diverse_net, measure_diverse_node, measure_diverse_tie, measure_features, measure_fit, measure_fragmentation, measure_hierarchy, measure_periods

Other nodal: mark_core, mark_degree, mark_diff, mark_nodes, mark_select_node, measure_accuracy_node, measure_assort_node, measure_broker_node, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_closure_node, measure_core, measure_diffusion_node, measure_diverse_node, member_brokerage, member_cliques, member_community, member_community_hier, member_community_modular, member_community_partition, member_community_spread, member_components, member_core, member_diffusion, member_equivalence, motif_accuracy_node, motif_brokerage_node, motif_clique, motif_composition, motif_exposure, motif_node, motif_path

Examples

node_by_eigenvector(ison_southern_women)
node_by_power(ison_southern_women, exponent = 0.5)

Measures of tie betweenness-like centrality

Description

tie_by_betweenness() measures the number of shortest paths going through a tie.

All measures attempt to use as much information as they are offered, including whether the networks are directed, weighted, or multimodal. If this would produce unintended results, first transform the salient properties using e.g. to_undirected() functions. All centrality and centralization measures return normalized measures by default, including for two-mode networks.

Usage

tie_by_betweenness(.data, normalized = TRUE)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

normalized

Logical scalar, whether scores are normalized. Different denominators may be used depending on the measure, whether the object is one-mode or two-mode, and other arguments. By default TRUE.

Value

A tie_measure numeric vector the length of the ties in the network, providing the scores for each tie. If the network is labelled, then the scores will be labelled with the ties' adjacent nodes' names.

The object also carries the measure it computed, the range its values can fall within, and whether and how those values were normalized. These are shown as a one-line header when the object is printed. Where a measure offers a choice between several ways of counting the same thing, it also carries the variant it used. All can be retrieved with attr().

Edge betweenness centrality

The betweenness centrality of a tie, also known as edge betweenness, counts the shortest paths between other nodes that run along it. It is best known as the quantity iteratively recomputed by the Girvan-Newman community detection algorithm, where the ties with the highest betweenness are removed first; see node_in_betweenness().

For signed networks, tie_by_betweenness() reads each tie by its magnitude. A tie measure holds one value per tie, so it cannot drop the negative ties as the distance measures at the node and network level do. This is what node_by_betweenness() in effect does for a network whose ties are signed but not weighted. Use manynet::to_unsigned() first to control this yourself.

References

On edge betweenness centrality

Girvan, Michelle, and Mark E.J. Newman. 2002. "Community structure in social and biological networks". Proceedings of the National Academy of Sciences 99(12): 7821-7826. doi:10.1073/pnas.122653799

Brandes, Ulrik. 2001. "A faster algorithm for betweenness centrality". Journal of Mathematical Sociology 25(2): 163-177. doi:10.1080/0022250X.2001.9990249

See Also

Other betweenness: measure_central_between, measure_centralisation_between

Other centrality: measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_central_tie_close, measure_central_tie_degree, measure_central_tie_eigen, measure_centralisation_between, measure_centralisation_close, measure_centralisation_degree, measure_centralisation_eigen

Other measures: measure_accuracy_net, measure_accuracy_node, measure_assort_net, measure_assort_node, measure_breadth, measure_broker_node, measure_broker_tie, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_central_tie_close, measure_central_tie_degree, measure_central_tie_eigen, measure_closure, measure_closure_node, measure_cohesion, measure_core, measure_diffusion_infection, measure_diffusion_net, measure_diffusion_node, measure_diverse_net, measure_diverse_node, measure_diverse_tie, measure_features, measure_fit, measure_fragmentation, measure_hierarchy, measure_periods

Other tie: mark_dyads, mark_select_tie, mark_ties, mark_triangles, measure_broker_tie, measure_central_tie_close, measure_central_tie_degree, measure_central_tie_eigen, measure_diverse_tie, member_community_link

Examples

(tb <- tie_by_betweenness(ison_adolescents))
ison_adolescents |> mutate_ties(weight = tb)

Measures of tie closeness-like centrality

Description

tie_by_closeness() measures the closeness of each tie to other ties in the network.

All measures attempt to use as much information as they are offered, including whether the networks are directed, weighted, or multimodal. If this would produce unintended results, first transform the salient properties using e.g. to_undirected() functions. All centrality and centralization measures return normalized measures by default, including for two-mode networks.

Usage

tie_by_closeness(.data, normalized = TRUE)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

normalized

Logical scalar, whether scores are normalized. Different denominators may be used depending on the measure, whether the object is one-mode or two-mode, and other arguments. By default TRUE.

Value

A tie_measure numeric vector the length of the ties in the network, providing the scores for each tie. If the network is labelled, then the scores will be labelled with the ties' adjacent nodes' names.

The object also carries the measure it computed, the range its values can fall within, and whether and how those values were normalized. These are shown as a one-line header when the object is printed. Where a measure offers a choice between several ways of counting the same thing, it also carries the variant it used. All can be retrieved with attr().

See Also

Other closeness: measure_central_close, measure_centralisation_close

Other centrality: measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_central_tie_between, measure_central_tie_degree, measure_central_tie_eigen, measure_centralisation_between, measure_centralisation_close, measure_centralisation_degree, measure_centralisation_eigen

Other measures: measure_accuracy_net, measure_accuracy_node, measure_assort_net, measure_assort_node, measure_breadth, measure_broker_node, measure_broker_tie, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_central_tie_between, measure_central_tie_degree, measure_central_tie_eigen, measure_closure, measure_closure_node, measure_cohesion, measure_core, measure_diffusion_infection, measure_diffusion_net, measure_diffusion_node, measure_diverse_net, measure_diverse_node, measure_diverse_tie, measure_features, measure_fit, measure_fragmentation, measure_hierarchy, measure_periods

Other tie: mark_dyads, mark_select_tie, mark_ties, mark_triangles, measure_broker_tie, measure_central_tie_between, measure_central_tie_degree, measure_central_tie_eigen, measure_diverse_tie, member_community_link

Examples

(ec <- tie_by_closeness(ison_adolescents))
ison_adolescents |> mutate_ties(weight = ec)

Measures of tie degree-like centrality

Description

tie_by_degree() measures the degree centrality of ties in a network

All measures attempt to use as much information as they are offered, including whether the networks are directed, weighted, or multimodal. If this would produce unintended results, first transform the salient properties using e.g. to_undirected() functions. All centrality and centralization measures return normalized measures by default, including for two-mode networks.

Usage

tie_by_degree(.data, normalized = TRUE)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

normalized

Logical scalar, whether scores are normalized. Different denominators may be used depending on the measure, whether the object is one-mode or two-mode, and other arguments. By default TRUE.

Value

A tie_measure numeric vector the length of the ties in the network, providing the scores for each tie. If the network is labelled, then the scores will be labelled with the ties' adjacent nodes' names.

The object also carries the measure it computed, the range its values can fall within, and whether and how those values were normalized. These are shown as a one-line header when the object is printed. Where a measure offers a choice between several ways of counting the same thing, it also carries the variant it used. All can be retrieved with attr().

See Also

Other degree: mark_degree, measure_central_degree, measure_centralisation_degree

Other centrality: measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_central_tie_between, measure_central_tie_close, measure_central_tie_eigen, measure_centralisation_between, measure_centralisation_close, measure_centralisation_degree, measure_centralisation_eigen

Other measures: measure_accuracy_net, measure_accuracy_node, measure_assort_net, measure_assort_node, measure_breadth, measure_broker_node, measure_broker_tie, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_central_tie_between, measure_central_tie_close, measure_central_tie_eigen, measure_closure, measure_closure_node, measure_cohesion, measure_core, measure_diffusion_infection, measure_diffusion_net, measure_diffusion_node, measure_diverse_net, measure_diverse_node, measure_diverse_tie, measure_features, measure_fit, measure_fragmentation, measure_hierarchy, measure_periods

Other tie: mark_dyads, mark_select_tie, mark_ties, mark_triangles, measure_broker_tie, measure_central_tie_between, measure_central_tie_close, measure_central_tie_eigen, measure_diverse_tie, member_community_link

Examples

tie_by_degree(ison_adolescents)

Measures of tie eigenvector-like centrality

Description

tie_by_eigenvector() measures the eigenvector centrality of ties in a network.

All measures attempt to use as much information as they are offered, including whether the networks are directed, weighted, or multimodal. If this would produce unintended results, first transform the salient properties using e.g. to_undirected() functions. All centrality and centralization measures return normalized measures by default, including for two-mode networks.

Usage

tie_by_eigenvector(.data, normalized = TRUE)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

normalized

Logical scalar, whether scores are normalized. Different denominators may be used depending on the measure, whether the object is one-mode or two-mode, and other arguments. By default TRUE.

Value

A tie_measure numeric vector the length of the ties in the network, providing the scores for each tie. If the network is labelled, then the scores will be labelled with the ties' adjacent nodes' names.

The object also carries the measure it computed, the range its values can fall within, and whether and how those values were normalized. These are shown as a one-line header when the object is printed. Where a measure offers a choice between several ways of counting the same thing, it also carries the variant it used. All can be retrieved with attr().

See Also

Other eigenvector: measure_central_eigen, measure_centralisation_eigen

Other centrality: measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_central_tie_between, measure_central_tie_close, measure_central_tie_degree, measure_centralisation_between, measure_centralisation_close, measure_centralisation_degree, measure_centralisation_eigen

Other measures: measure_accuracy_net, measure_accuracy_node, measure_assort_net, measure_assort_node, measure_breadth, measure_broker_node, measure_broker_tie, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_central_tie_between, measure_central_tie_close, measure_central_tie_degree, measure_closure, measure_closure_node, measure_cohesion, measure_core, measure_diffusion_infection, measure_diffusion_net, measure_diffusion_node, measure_diverse_net, measure_diverse_node, measure_diverse_tie, measure_features, measure_fit, measure_fragmentation, measure_hierarchy, measure_periods

Other tie: mark_dyads, mark_select_tie, mark_ties, mark_triangles, measure_broker_tie, measure_central_tie_between, measure_central_tie_close, measure_central_tie_degree, measure_diverse_tie, member_community_link

Examples

tie_by_eigenvector(ison_adolescents)

Measures of network betweenness-like centralisation

Description

  • net_by_betweenness() measures the betweenness centralization for a network as a single score.

  • mode_by_betweenness() measures betweenness centralization separately for each mode of a two-mode network, returning one score per mode (following Borgatti and Everett, 1997).

All measures attempt to use as much information as they are offered, including whether the networks are directed, weighted, or multimodal. If this would produce unintended results, first transform the salient properties using e.g. to_undirected() functions. All centrality and centralization measures return normalized measures by default, including for two-mode networks.

For two-mode networks the two modes have different theoretical maxima, so net_by_betweenness() reports a single network-level score by applying Freeman's general centralization index over the normalized node betweenness scores, whereas mode_by_betweenness() reports the per-mode scores directly.

Usage

net_by_betweenness(.data, normalized = TRUE)

mode_by_betweenness(.data, normalized = TRUE, direction = c("all", "in"))

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

normalized

Logical scalar, whether scores are normalized. Different denominators may be used depending on the measure, whether the object is one-mode or two-mode, and other arguments. By default TRUE.

direction

Character string, “out” bases the measure on outgoing ties, “in” on incoming ties, and "all" on either/the sum of the two. By default "all".

Details

Betweenness centralisation has no directional variants: igraph::centr_betw() derives directedness from the network itself, so net_by_betweenness() takes no direction argument. For the per-mode scores, direction chooses the comparison set rather than a tie direction — "all" compares each mode's most central node against every node in the network, whereas "in" compares it only against the other nodes of its own mode. Since a two-mode incidence structure gives these no distinct "out" counterpart, mode_by_betweenness() accepts only "all" and "in".

For signed networks, these measures consider only the positive ties, and say so. They read a tie as a distance, and a negative tie is hostility rather than a channel along which cohesion travels. Use manynet::to_unsigned() first to control this yourself.

Value

net_by_betweenness() returns a network_measure scalar; mode_by_betweenness() returns a mode_measure numeric vector of length two, giving one centralization score per mode.

References

Borgatti, Stephen P., and Martin G. Everett. 1997. "Network analysis of 2-mode data." Social Networks 19(3): 243-269. doi:10.1016/S0378-8733(96)00301-2

See Also

Other betweenness: measure_central_between, measure_central_tie_between

Other centrality: measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_central_tie_between, measure_central_tie_close, measure_central_tie_degree, measure_central_tie_eigen, measure_centralisation_close, measure_centralisation_degree, measure_centralisation_eigen

Examples

net_by_betweenness(ison_southern_women)
mode_by_betweenness(ison_southern_women, direction = "in")

Measures of network closeness-like centralisation

Description

  • net_by_closeness() measures a network's closeness centralization as a single score.

  • mode_by_closeness() measures closeness centralization separately for each mode of a two-mode network, returning one score per mode (following Borgatti and Everett, 1997).

  • net_by_reach() measures a network's reach centralization.

  • net_by_decay() measures a network's decay centralization.

  • net_by_harmonic() measures a network's harmonic centralization.

  • net_by_integration() measures a network's integration centralization.

All measures attempt to use as much information as they are offered, including whether the networks are directed, weighted, or multimodal. If this would produce unintended results, first transform the salient properties using e.g. to_undirected() functions. All centrality and centralization measures return normalized measures by default, including for two-mode networks.

For two-mode networks the two modes have different theoretical maxima, so net_by_closeness() reports a single network-level score by applying Freeman's general centralization index over the normalized node closeness scores, whereas mode_by_closeness() reports the per-mode scores directly.

Usage

net_by_closeness(.data, normalized = TRUE, direction = c("all", "out", "in"))

mode_by_closeness(.data, normalized = TRUE, direction = c("all", "out", "in"))

net_by_reach(.data, normalized = TRUE, cutoff = 2)

net_by_decay(.data, normalized = TRUE, decay = 0.5, direction = c("out", "in"))

net_by_integration(.data, normalized = TRUE, direction = c("in", "out"))

net_by_harmonic(.data, normalized = TRUE, cutoff = 2)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

normalized

Logical scalar, whether scores are normalized. Different denominators may be used depending on the measure, whether the object is one-mode or two-mode, and other arguments. By default TRUE.

direction

Character string, “out” bases the measure on outgoing ties, “in” on incoming ties, and "all" on either/the sum of the two. By default "all".

cutoff

Integer scalar, the maximum path length considered. Paths longer than this are ignored, which restricts the measure to a node's local neighbourhood. Where a measure is defined over all paths by default, a negative value or NULL imposes no limit.

decay

A proportion between 0 and 1 giving how much of a contribution survives each additional step of distance or walk length. Lower values discount more steeply, so that only nearby others count; higher values discount less, so that longer walks continue to contribute. The measures that take a decay differ in what they discount and in what value leaves the measure in its most familiar form, so each documents its own default.

Details

For signed networks, these measures consider only the positive ties, and say so. They read a tie as a distance, and a negative tie is hostility rather than a channel along which cohesion travels. Use manynet::to_unsigned() first to control this yourself.

Value

⁠net_by_*()⁠ functions return a network_measure scalar; mode_by_closeness() returns a mode_measure numeric vector of length two, giving one centralization score per mode.

Decay and integration centralization

Unlike reach centrality, decay and integration scores are not bounded above by N−1N-1: integration scores scale with the network's diameter. Freeman's index therefore cannot use the same denominator as net_by_reach(), which would return negative values. Instead these apply the general centralization index over the normalized node scores, each of which lies in [0,1][0,1], so the numerator's maximum is N−1N-1 and the result is guaranteed to lie in [0,1][0,1]. This is the same approach net_by_closeness() takes for two-mode networks.

References

Borgatti, Stephen P., and Martin G. Everett. 1997. "Network analysis of 2-mode data." Social Networks 19(3): 243-269. doi:10.1016/S0378-8733(96)00301-2

See Also

Other closeness: measure_central_close, measure_central_tie_close

Other centrality: measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_central_tie_between, measure_central_tie_close, measure_central_tie_degree, measure_central_tie_eigen, measure_centralisation_between, measure_centralisation_degree, measure_centralisation_eigen

Examples

net_by_closeness(ison_southern_women, direction = "in")
mode_by_closeness(ison_southern_women, direction = "in")
net_by_decay(ison_adolescents)
net_by_integration(ison_adolescents)

Measures of network degree-like centralisation

Description

  • net_by_degree() measures a network's degree centralization as a single score; there are several related shortcut functions:

    • net_by_indegree() returns the direction = 'in' results.

    • net_by_outdegree() returns the direction = 'out' results.

  • mode_by_degree() measures degree centralization separately for each mode of a two-mode network, returning one score per mode (following Borgatti and Everett, 1997); it has the same shortcuts:

    • mode_by_indegree() returns the direction = 'in' results.

    • mode_by_outdegree() returns the direction = 'out' results.

All measures attempt to use as much information as they are offered, including whether the networks are directed, weighted, or multimodal. If this would produce unintended results, first transform the salient properties using e.g. to_undirected() functions. All centrality and centralization measures return normalized measures by default, including for two-mode networks.

For two-mode networks, the two modes have different theoretical maxima, so net_by_degree() reports a single network-level score by applying Freeman's general centralization index over the mode-normalized node degrees, whereas mode_by_degree() reports the per-mode centralization scores directly. For the per-mode scores, "all" uses as numerator the sum of differences between the maximum centrality score for the mode against all other centrality scores in the network, whereas "in" uses as numerator the sum of differences between the maximum centrality score for the mode against only the centrality scores of the other nodes in that mode.

Usage

net_by_degree(.data, normalized = TRUE, direction = c("all", "out", "in"))

mode_by_degree(.data, normalized = TRUE, direction = c("all", "out", "in"))

net_by_outdegree(.data, normalized = TRUE)

net_by_indegree(.data, normalized = TRUE)

mode_by_outdegree(.data, normalized = TRUE)

mode_by_indegree(.data, normalized = TRUE)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

normalized

Logical scalar, whether scores are normalized. Different denominators may be used depending on the measure, whether the object is one-mode or two-mode, and other arguments. By default TRUE.

direction

Character string, “out” bases the measure on outgoing ties, “in” on incoming ties, and "all" on either/the sum of the two. By default "all".

Value

⁠net_by_*()⁠ functions return a network_measure scalar; ⁠mode_by_*()⁠ functions return a mode_measure numeric vector of length two, giving one centralization score per mode.

References

On centralisation

Freeman, Linton C. 1978. "Centrality in social networks: Conceptual clarification". Social Networks 1(3): 215-239. doi:10.1016/0378-8733(78)90021-7

On two-mode centralisation

Borgatti, Stephen P., and Martin G. Everett. 1997. "Network analysis of 2-mode data." Social Networks 19(3): 243-269. doi:10.1016/S0378-8733(96)00301-2

See Also

Other degree: mark_degree, measure_central_degree, measure_central_tie_degree

Other centrality: measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_central_tie_between, measure_central_tie_close, measure_central_tie_degree, measure_central_tie_eigen, measure_centralisation_between, measure_centralisation_close, measure_centralisation_eigen

Examples

net_by_degree(ison_southern_women, direction = "in")
mode_by_degree(ison_southern_women, direction = "in")

Measures of network eigenvector-like centralisation

Description

  • net_by_eigenvector() measures the eigenvector centralization for a network as a single score.

  • mode_by_eigenvector() measures eigenvector centralization separately for each mode of a two-mode network (via projection to each mode), returning one score per mode (following Borgatti and Everett, 1997). A multilevel network cannot be projected, so there each mode's scores are read from the whole network.

All measures attempt to use as much information as they are offered, including whether the networks are directed, weighted, or multimodal. If this would produce unintended results, first transform the salient properties using e.g. to_undirected() functions. All centrality and centralization measures return normalized measures by default, including for two-mode networks.

For two-mode networks the two modes have different theoretical maxima, so net_by_eigenvector() reports a single network-level score by applying Freeman's general centralization index over the normalized node eigenvector scores, whereas mode_by_eigenvector() reports the per-mode scores directly.

Usage

net_by_eigenvector(.data, normalized = TRUE)

mode_by_eigenvector(.data, normalized = TRUE)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

normalized

Logical scalar, whether scores are normalized. Different denominators may be used depending on the measure, whether the object is one-mode or two-mode, and other arguments. By default TRUE.

Value

net_by_eigenvector() returns a network_measure scalar; mode_by_eigenvector() returns a mode_measure numeric vector of length two, giving one centralization score per mode.

References

Borgatti, Stephen P., and Martin G. Everett. 1997. "Network analysis of 2-mode data." Social Networks 19(3): 243-269. doi:10.1016/S0378-8733(96)00301-2

See Also

Other eigenvector: measure_central_eigen, measure_central_tie_eigen

Other centrality: measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_central_tie_between, measure_central_tie_close, measure_central_tie_degree, measure_central_tie_eigen, measure_centralisation_between, measure_centralisation_close, measure_centralisation_degree

Examples

net_by_eigenvector(ison_southern_women)
mode_by_eigenvector(ison_southern_women)

Measures of network closure

Description

These functions offer methods for summarising the closure in configurations in one-, two-, and three-mode networks:

  • net_by_reciprocity() measures reciprocity in a (usually directed) network.

  • net_by_transitivity() measures transitivity in a network.

  • net_by_cyclicality() measures cyclicality in a (necessarily directed) network.

  • net_by_equivalency() measures equivalence or reinforcement in a (usually two-mode) network.

  • net_by_congruency() measures congruency across two two-mode networks.

Usage

net_by_reciprocity(.data, variant = c("default", "ratio"), method = NULL)

net_by_transitivity(.data)

net_by_cyclicality(.data)

net_by_equivalency(.data)

net_by_congruency(.data, object2)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

variant

Character string naming which variant of the measure to compute, where more than one definition of the same quantity is in use. The variant chosen is reported when the result is printed.

method

Deprecated. The former spelling of variant. Still accepted, but warns; please use variant instead.

object2

Optionally, a second (two-mode) matrix, igraph, or tidygraph

Details

For one-mode networks, shallow wrappers of igraph versions exist via net_reciprocity and net_transitivity.

For two-mode networks, net_equivalency calculates the proportion of three-paths in the network that are closed by fourth tie to establish a "shared four-cycle" structure.

For three-mode networks, net_congruency calculates the proportion of three-paths spanning two two-mode networks that are closed by a fourth tie to establish a "congruent four-cycle" structure.

net_by_reciprocity() takes a variant: either "default", the share of ties that are reciprocated, or "ratio", the share of dyads that are mutual rather than asymmetric. See ?igraph::reciprocity.

Value

A network_measure numeric score.

The object also carries the measure it computed, the range its values can fall within, and whether and how those values were normalized. These are shown as a one-line header when the object is printed. Where a measure offers a choice between several ways of counting the same thing, it also carries the variant it used. All can be retrieved with attr().

Cyclicality

Where transitivity asks how often a two-path i→j→ki \to j \to k is closed by a tie i→ki \to k, cyclicality asks how often it is closed in the other direction, by k→ik \to i:

C=∣{i→j→k→i}∣∣{i→j→k}∣C = \frac{|\{i \to j \to k \to i\}|}{|\{i \to j \to k\}|}

The two capture different social logics. Transitivity is the signature of hierarchy and of "a friend of a friend is a friend", while cyclicality is the signature of generalised exchange, where resources circulate around a loop rather than flowing consistently in one direction.

A two-mode network contains no cycle of odd length, so it scores 0 here, just as it does for transitivity. Use net_by_equivalency() for closure in a two-mode network, which counts four-cycles instead.

In an undirected network every two-path closed in one direction is also closed in the other, so cyclicality and transitivity coincide.

Equivalency

The net_by_equivalency() function calculates the Robins and Alexander (2004) clustering coefficient for two-mode networks. The coefficient is a proportion of three-paths, and so is defined on binary data; weighted networks are dichotomised before it is calculated.

References

On cyclicality and generalised exchange

Bearman, Peter. 1997. "Generalized Exchange". American Journal of Sociology 102(5): 1383-1415. doi:10.1086/231087

On equivalency or four-cycles

Robins, Garry L, and Malcolm Alexander. 2004. Small worlds among interlocking directors: Network structure and distance in bipartite graphs. Computational & Mathematical Organization Theory 10(1): 69–94. doi:10.1023/B:CMOT.0000032580.12184.c0.

On congruency

Knoke, David, Mario Diani, James Hollway, and Dimitris C Christopoulos. 2021. Multimodal Political Networks. Cambridge University Press. Cambridge University Press. doi:10.1017/9781108985000

See Also

Other measures: measure_accuracy_net, measure_accuracy_node, measure_assort_net, measure_assort_node, measure_breadth, measure_broker_node, measure_broker_tie, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_central_tie_between, measure_central_tie_close, measure_central_tie_degree, measure_central_tie_eigen, measure_closure_node, measure_cohesion, measure_core, measure_diffusion_infection, measure_diffusion_net, measure_diffusion_node, measure_diverse_net, measure_diverse_node, measure_diverse_tie, measure_features, measure_fit, measure_fragmentation, measure_hierarchy, measure_periods

Examples

net_by_reciprocity(ison_southern_women)
net_by_transitivity(ison_adolescents)
net_by_cyclicality(ison_networkers)
net_by_equivalency(ison_southern_women)

Measures of node closure

Description

These functions offer methods for summarising the closure in configurations in one- and two-mode networks:

  • node_by_reciprocity() measures nodes' reciprocity.

  • node_by_transitivity() measures nodes' transitivity.

  • node_by_equivalency() measures nodes' equivalence or reinforcement in a (usually two-mode) network.

Usage

node_by_reciprocity(.data)

node_by_transitivity(.data, variant = c("watts", "barrat", "onnela", "zhang"))

node_by_equivalency(.data)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

variant

Character string naming which variant of the measure to compute, where more than one definition of the same quantity is in use. The variant chosen is reported when the result is printed.

Details

For one-mode networks, node_by_reciprocity is a shallow wrapper of the igraph version, and node_by_transitivity offers the igraph version alongside three weighted clustering coefficients.

For two-mode networks, node_by_equivalency calculates the proportion of three-paths in the network that are closed by fourth tie to establish a "shared four-cycle" structure.

Value

A node_measure numeric vector the length of the nodes in the network, providing the scores for each node. If the network is labelled, then the scores will be labelled with the nodes' names.

The object also carries the measure it computed, the range its values can fall within, and whether and how those values were normalized. These are shown as a one-line header when the object is printed. Where a measure offers a choice between several ways of counting the same thing, it also carries the variant it used. All can be retrieved with attr().

Node reciprocity

A node's reciprocity is the proportion of its ties that are returned. Where a network is undirected, including where it is two-mode, there is no direction for a tie to be returned along, so every node scores 1. This is what net_by_reciprocity() reports for such a network too.

Node transitivity

A node's transitivity is the proportion of its neighbours that are themselves connected, which is also known as the local clustering coefficient of the node. Where aija_{ij} indicates a tie and kik_i is the node's degree, the "watts" variant (Watts and Strogatz 1998) counts the node's closed triangles:

Ci=∑j,haijaihajhki(ki−1)C_i = \frac{\sum_{j,h} a_{ij} a_{ih} a_{jh}}{k_i(k_i - 1)}

The other variants weight each triangle by the ties' weights wijw_{ij}, and differ in which weights count:

  • "barrat" (Barrat et al. 2004) weights each triangle by the mean weight of the node's own two ties in it, divided by the node's strength sis_i. Only whether the tie opposite the node is present counts:

    Ci=1si(ki−1)∑j,hwij+wih2aijaihajhC_i = \frac{1}{s_i(k_i - 1)} \sum_{j,h} \frac{w_{ij} + w_{ih}}{2} a_{ij} a_{ih} a_{jh}

  • "onnela" (Onnela et al. 2005) weights each triangle by the geometric mean of all three of its weights, each divided by the network's largest weight, so that a triangle closed by a weak tie counts for less:

    Ci=1ki(ki−1)∑j,h(w^ijw^ihw^jh)1/3C_i = \frac{1}{k_i(k_i - 1)} \sum_{j,h} (\hat{w}_{ij} \hat{w}_{ih} \hat{w}_{jh})^{1/3}

  • "zhang" (Zhang and Horvath 2005) divides the product of the three weights by the most that the node's own weights allow:

    Ci=∑j,hw^ijw^ihw^jh(∑jw^ij)2−∑jw^ij2C_i = \frac{\sum_{j,h} \hat{w}_{ij} \hat{w}_{ih} \hat{w}_{jh}}{(\sum_j \hat{w}_{ij})^2 - \sum_j \hat{w}_{ij}^2}

Saramäki et al. (2007) compare the three. On an unweighted network, all four variants give the same values. The first choice, "watts", is the default on an unweighted network only. On a weighted network, the default is "barrat", since this is the weighted form that reduces most directly to the unweighted one; use variant = "watts" to ignore the weights. A node with fewer than two ties has no pair of neighbours to close, and scores NaN in every variant. A two-mode network contains no triangles, so every node scores 0 or NaN.

For directed networks, transitivity here ignores the direction of ties. The weighted variants add the weights of the two directions of a tie, following Fagiolo (2007). Every weighted variant is unchanged when all weights are multiplied by the same number, so this gives the same result as their mean. To combine the two directions differently, use manynet::to_undirected() first.

For multiplex networks, the "watts" variant counts a pair of nodes as tied if they are tied in any layer. The weighted variants add the weights of the parallel ties between two nodes, so that, in an unweighted multiplex network, a tie is weighted by the number of layers it appears in. To measure one layer alone, use manynet::to_uniplex() first.

For signed networks, each tie is read by the magnitude of its weight, since a tie counts here however it is signed. To consider only the positive ties, use manynet::to_unsigned(keep = "positive") first.

References

On the local clustering coefficient

Watts, Duncan J., and Steven H. Strogatz. 1998. "Collective dynamics of 'small-world' networks". Nature 393(6684): 440-442. doi:10.1038/30918

Holland, Paul W., and Samuel Leinhardt. 1971. "Transitivity in structural models of small groups". Comparative Group Studies 2(2): 107-124. doi:10.1177/104649647100200201

On weighted clustering

Barrat, Alain, Marc Barthelemy, Romualdo Pastor-Satorras, and Alessandro Vespignani. 2004. "The architecture of complex weighted networks". Proceedings of the National Academy of Sciences 101(11): 3747-3752. doi:10.1073/pnas.0400087101

Onnela, Jukka-Pekka, Jari Saramäki, János Kertész, and Kimmo Kaski. 2005. "Intensity and coherence of motifs in weighted complex networks". Physical Review E 71(6): 065103. doi:10.1103/PhysRevE.71.065103

Zhang, Bin, and Steve Horvath. 2005. "A general framework for weighted gene co-expression network analysis". Statistical Applications in Genetics and Molecular Biology 4(1): 17. doi:10.2202/1544-6115.1128

Saramäki, Jari, Mikko Kivelä, Jukka-Pekka Onnela, Kimmo Kaski, and János Kertész. 2007. "Generalizations of the clustering coefficient to weighted complex networks". Physical Review E 75(2): 027105. doi:10.1103/PhysRevE.75.027105

Fagiolo, Giorgio. 2007. "Clustering in complex directed networks". Physical Review E 76(2): 026107. doi:10.1103/PhysRevE.76.026107

See Also

Other measures: measure_accuracy_net, measure_accuracy_node, measure_assort_net, measure_assort_node, measure_breadth, measure_broker_node, measure_broker_tie, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_central_tie_between, measure_central_tie_close, measure_central_tie_degree, measure_central_tie_eigen, measure_closure, measure_cohesion, measure_core, measure_diffusion_infection, measure_diffusion_net, measure_diffusion_node, measure_diverse_net, measure_diverse_node, measure_diverse_tie, measure_features, measure_fit, measure_fragmentation, measure_hierarchy, measure_periods

Other nodal: mark_core, mark_degree, mark_diff, mark_nodes, mark_select_node, measure_accuracy_node, measure_assort_node, measure_broker_node, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_core, measure_diffusion_node, measure_diverse_node, member_brokerage, member_cliques, member_community, member_community_hier, member_community_modular, member_community_partition, member_community_spread, member_components, member_core, member_diffusion, member_equivalence, motif_accuracy_node, motif_brokerage_node, motif_clique, motif_composition, motif_exposure, motif_node, motif_path

Examples

node_by_reciprocity(ison_networkers)
node_by_transitivity(ison_adolescents)
node_by_transitivity(ison_networkers)
node_by_transitivity(ison_networkers, variant = "onnela")

Measures of network cohesion

Description

These functions return values or vectors relating to how cohesive a network is:

  • net_by_density() measures the ratio of ties to the number of possible ties.

  • net_by_compactness() measures the average closeness of all pairs of nodes in the network.

  • net_by_components() measures the number of components in the network, either strongly or weakly connected.

  • net_by_independence() measures the independence number, or size of the largest independent set in the network.

Usage

net_by_density(.data)

net_by_compactness(.data)

net_by_components(.data, connectivity = c("strong", "weak"))

net_by_independence(.data)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

connectivity

Character string, "weak" treats a directed network's components as if the network were undirected, and "strong" requires ties in both directions between members. This is ignored for undirected networks, where the two notions coincide. Note that the default differs by function: functions that assert or count connectedness default to "strong", while functions that scope or split a network into components default to "weak".

Details

For signed networks, net_by_compactness() considers only the positive ties. It measures distance, and a negative tie is hostility rather than a channel along which cohesion travels. Use manynet::to_unsigned() first to control this yourself. The other measures in this topic do not depend on distance, and so use every tie whatever its sign.

For multilevel networks, net_by_independence() measures the network whole, which is the quantity wanted in any case. A multilevel network reports itself as two-mode, but holds ties within a mode as well as between them, so it cannot be projected onto one mode. The projection remains for genuine two-mode networks, where no two nodes of one mode are ever tied and the unprojected answer would be trivially the larger mode.

Value

A network_measure numeric score.

The object also carries the measure it computed, the range its values can fall within, and whether and how those values were normalized. These are shown as a one-line header when the object is printed. Where a measure offers a choice between several ways of counting the same thing, it also carries the variant it used. All can be retrieved with attr().

Compactness

Compactness is the average of the reciprocal distances between all pairs of nodes:

C=∑i≠j1d(i,j)N(N−1)C = \frac{\sum_{i \neq j} \frac{1}{d(i,j)}}{N(N-1)}

where unreachable pairs contribute 00. Its complement, 1−C1 - C, is sometimes called breadth.

Compactness is more discriminating than net_by_connectedness(), which counts only whether pairs are reachable at all. Two networks in which every node can reach every other are equally connected, but the one in which they do so in fewer steps is more compact. A complete network scores 1, and an empty network 0. It is the network-level counterpart of node_by_harmonic(), such that net_by_compactness(ison_adolescents) == mean(node_by_harmonic(ison_adolescents, normalized = TRUE, cutoff = -1)).

Note that this quantity is known in the physics literature as the global efficiency of a network (Latora and Marchiori 2001). It is named compactness here for the social network analytic tradition, partly to avoid confusion with the unrelated net_by_efficiency() (Krackhardt) and node_by_efficiency() (Burt).

References

On compactness

Borgatti, Stephen P., Martin G. Everett, Jeffrey C. Johnson, and Filip Agneessens. 2022. Analyzing Social Networks Using R, chapter 10. London: SAGE.

Latora, Vito, and Massimo Marchiori. 2001. "Efficient Behavior of Small-World Networks". Physical Review Letters 87(19): 198701. doi:10.1103/PhysRevLett.87.198701

See Also

Other cohesion: mark_triangles, measure_breadth, measure_fragmentation, motif_net, motif_node

Other measures: measure_accuracy_net, measure_accuracy_node, measure_assort_net, measure_assort_node, measure_breadth, measure_broker_node, measure_broker_tie, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_central_tie_between, measure_central_tie_close, measure_central_tie_degree, measure_central_tie_eigen, measure_closure, measure_closure_node, measure_core, measure_diffusion_infection, measure_diffusion_net, measure_diffusion_node, measure_diverse_net, measure_diverse_node, measure_diverse_tie, measure_features, measure_fit, measure_fragmentation, measure_hierarchy, measure_periods

Examples

net_by_density(ison_adolescents)
net_by_density(ison_southern_women)
net_by_compactness(ison_adolescents)
net_by_compactness(ison_southern_women)
net_by_components(fict_thrones)
net_by_components(fict_thrones, connectivity = "weak")
net_by_independence(ison_adolescents)
net_by_independence(fict_actually)

Measures of node coreness

Description

These functions identify nodes belonging to (some level of) the core of a network:

  • node_by_core() returns a continuous measure of how closely each node resembles a typical core node.

  • node_by_kcoreness() assigns nodes to their level of k-coreness.

Usage

node_by_kcoreness(.data)

node_by_core(.data, coreness = NULL, direction = c("all", "out", "in"))

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

coreness

Which method to use to calculate nodes' coreness. One of "correlation", "rich", "transition", or "hub"; see method_coreness for what each does. By default NULL, which uses "rich" for a weighted, directed, or two-mode network, since it is the only method that reads those properties directly, and "correlation" otherwise.

direction

One of "all" (the default), "out", or "in". For a directed network, "out" scores nodes on the ties they send and "in" on the ties they receive. Ignored for undirected and two-mode networks.

Value

A node_measure numeric vector the length of the nodes in the network, providing the scores for each node. If the network is labelled, then the scores will be labelled with the nodes' names.

The object also carries the measure it computed, the range its values can fall within, and whether and how those values were normalized. These are shown as a one-line header when the object is printed. Where a measure offers a choice between several ways of counting the same thing, it also carries the variant it used. All can be retrieved with attr().

k-coreness

k-coreness captures the maximal subgraphs in which each vertex has at least degree k, where k is also the order of the subgraph. As described in igraph::coreness, a node's coreness is k if it belongs to the k-core but not to the (k+1)-core.

Coreness

Where node_is_core() forces a yes or no answer, node_by_core() grades how core-like each node is on a scale from 0 to 1. The two agree on which method to use and read the same coreness and direction arguments, so the mark is always the cut of the measure returned here.

Each method uses as much of the network as it can. The rich-core and hub methods read tie weights and tie direction directly. The correlation and transition methods compare the network against a symmetric ideal, so they symmetrise a directed network and say that they have done so. To keep a method from using a property, transform the network first with e.g. manynet::to_undirected() or manynet::to_unweighted().

This function was called node_by_coreness() prior to version 1.0.0. It is now named for the property, as node_is_core() and node_in_core() are, which also frees "coreness" from meaning two different things: the continuous score here, and the peeling depth of node_by_kcoreness().

References

On k-coreness

Seidman, Stephen B. 1983. "Network structure and minimum degree". Social Networks, 5(3), 269-287. doi:10.1016/0378-8733(83)90028-X

Batagelj, Vladimir, and Matjaz Zaversnik. 2003. "An O(m) algorithm for cores decomposition of networks". arXiv preprint cs/0310049. doi:10.48550/arXiv.cs/0310049

See Also

Other core-periphery: mark_core, member_core

Other measures: measure_accuracy_net, measure_accuracy_node, measure_assort_net, measure_assort_node, measure_breadth, measure_broker_node, measure_broker_tie, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_central_tie_between, measure_central_tie_close, measure_central_tie_degree, measure_central_tie_eigen, measure_closure, measure_closure_node, measure_cohesion, measure_diffusion_infection, measure_diffusion_net, measure_diffusion_node, measure_diverse_net, measure_diverse_node, measure_diverse_tie, measure_features, measure_fit, measure_fragmentation, measure_hierarchy, measure_periods

Other nodal: mark_core, mark_degree, mark_diff, mark_nodes, mark_select_node, measure_accuracy_node, measure_assort_node, measure_broker_node, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_closure_node, measure_diffusion_node, measure_diverse_node, member_brokerage, member_cliques, member_community, member_community_hier, member_community_modular, member_community_partition, member_community_spread, member_components, member_core, member_diffusion, member_equivalence, motif_accuracy_node, motif_brokerage_node, motif_clique, motif_composition, motif_exposure, motif_node, motif_path

Examples

node_by_kcoreness(ison_adolescents)
node_by_core(ison_adolescents)
node_by_core(ison_networkers, direction = "out")

Measures of network infection

Description

These functions allow measurement of various features of a diffusion process at the network level:

  • net_by_infection_complete() measures the number of time steps until (the first instance of) complete infection. For diffusions that are not observed to complete, this function returns the value of Inf (infinity). This makes sure that at least ordinality is respected.

  • net_by_infection_total() measures the proportion or total number of nodes that are infected/activated at some time by the end of the diffusion process. This includes nodes that subsequently recover. Where reinfection is possible, the proportion may be higher than 1.

  • net_by_infection_peak() measures the number of time steps until the highest infection rate is observed.

Usage

net_by_infection_complete(.data)

net_by_infection_total(.data, normalized = TRUE)

net_by_infection_peak(.data)

Arguments

.data

Network data with nodal changes, as created by play_diffusion(), or a valid network diffusion model, as created by as_diffusion().

normalized

Logical scalar, whether scores are normalized. Different denominators may be used depending on the measure, whether the object is one-mode or two-mode, and other arguments. By default TRUE.

Value

A network_measure numeric score.

The object also carries the measure it computed, the range its values can fall within, and whether and how those values were normalized. These are shown as a one-line header when the object is printed. Where a measure offers a choice between several ways of counting the same thing, it also carries the variant it used. All can be retrieved with attr().

See Also

Other diffusion: mark_diff, measure_diffusion_net, measure_diffusion_node, member_diffusion, motif_exposure, motif_hazard

Other measures: measure_accuracy_net, measure_accuracy_node, measure_assort_net, measure_assort_node, measure_breadth, measure_broker_node, measure_broker_tie, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_central_tie_between, measure_central_tie_close, measure_central_tie_degree, measure_central_tie_eigen, measure_closure, measure_closure_node, measure_cohesion, measure_core, measure_diffusion_net, measure_diffusion_node, measure_diverse_net, measure_diverse_node, measure_diverse_tie, measure_features, measure_fit, measure_fragmentation, measure_hierarchy, measure_periods

Examples

smeg <- generate_smallworld(15, 0.025)
  smeg_diff <- play_diffusion(smeg)
  net_by_infection_complete(smeg_diff)
  net_by_infection_total(smeg_diff)
  net_by_infection_peak(smeg_diff)

Measures of network diffusion

Description

These functions allow measurement of various features of a diffusion process at the network level:

  • net_by_transmissibility() measures the average transmissibility observed in a diffusion simulation, or the number of new infections over the number of susceptible nodes.

  • net_by_recovery() measures the average number of time steps nodes remain infected once they become infected.

  • net_by_reproduction() measures the observed reproductive number in a diffusion simulation as the network's transmissibility over the network's average infection length.

  • net_by_immunity() measures the proportion of nodes that would need to be protected through vaccination, isolation, or recovery for herd immunity to be reached.

Usage

net_by_transmissibility(.data)

net_by_recovery(.data, censor = TRUE)

net_by_reproduction(.data)

net_by_immunity(.data, normalized = TRUE)

Arguments

.data

Network data with nodal changes, as created by play_diffusion(), or a valid network diffusion model, as created by as_diffusion().

censor

Where some nodes have not yet recovered by the end of the simulation, right censored values can be replaced by the number of steps. By default TRUE. Note that this will likely still underestimate recovery.

normalized

Logical scalar, whether scores are normalized. Different denominators may be used depending on the measure, whether the object is one-mode or two-mode, and other arguments. By default TRUE.

Value

A network_measure numeric score.

The object also carries the measure it computed, the range its values can fall within, and whether and how those values were normalized. These are shown as a one-line header when the object is printed. Where a measure offers a choice between several ways of counting the same thing, it also carries the variant it used. All can be retrieved with attr().

Transmissibility

net_transmissibility() measures how many directly susceptible nodes each infected node will infect in each time period, on average. That is:

T=1n∑j=1nijsjT = \frac{1}{n}\sum_{j=1}^n \frac{i_{j}}{s_{j}}

where ii is the number of new infections in each time period, j∈nj \in n, and ss is the number of nodes that could have been infected in that time period (note that s≠Ss \neq S, or the number of nodes that are susceptible in the population). TT can be interpreted as the proportion of susceptible nodes that are infected at each time period.

Recovery time

net_recovery() measures the average number of time steps that nodes in a network remain infected. Note that in a diffusion model without recovery, average infection length will be infinite. This will also be the case where there is right censoring. The longer nodes remain infected, the longer they can infect others.

Reproduction number

net_reproduction() measures a given diffusion's reproductive number. Here it is calculated as:

R=min⁡(T1/L,kˉ)R = \min\left(\frac{T}{1/L}, \bar{k}\right)

where TT is the observed transmissibility in a diffusion and LL is the observed recovery length in a diffusion. Since LL can be infinite where there is no recovery or there is right censoring, and since network structure places an upper limit on how many nodes each node may further infect (their degree), this function returns the minimum of R0R_0 and the network's average degree.

Interpretation of the reproduction number is oriented around R = 1. Where R>1R > 1, the 'disease' will 'infect' more and more nodes in the network. Where R<1R < 1, the 'disease' will not sustain itself and eventually die out. Where R=1R = 1, the 'disease' will continue as endemic, if conditions allow.

Herd immunity

net_immunity() estimates the proportion of a network that need to be protected from infection for herd immunity to be achieved. This is known as the Herd Immunity Threshold or HIT:

1−1R1 - \frac{1}{R}

where RR is the reproduction number from net_reproduction(). The HIT indicates the threshold at which the reduction of susceptible members of the network means that infections will no longer keep increasing. Note that there may still be more infections after this threshold has been reached, but there should be fewer and fewer. These excess infections are called the overshoot. This function does not take into account the structure of the network, instead using the average degree.

Interpretation is quite straightforward. A HIT or immunity score of 0.75 would mean that 75% of the nodes in the network would need to be vaccinated or otherwise protected to achieve herd immunity. To identify how many nodes this would be, multiply this proportion with the number of nodes in the network.

Where R<1R < 1 the diffusion is already sub-critical and dies out of its own accord, so no one needs protecting and the threshold is reported as 0. The formula would otherwise return a negative proportion, which has no interpretation.

References

On epidemiological models

Kermack, William O., and Anderson Gray McKendrick. 1927. "A contribution to the mathematical theory of epidemics". Proc. R. Soc. London A 115: 700-721. doi:10.1098/rspa.1927.0118

On the basic reproduction number

Diekmann, Odo, Hans J.A.P. Heesterbeek, and Hans J.A.J. Metz. 1990. "On the definition and the computation of the basic reproduction ratio R0 in models for infectious diseases in heterogeneous populations". Journal of Mathematical Biology, 28(4): 365–82. doi:10.1007/BF00178324

Kenah, Eben, and James M. Robins. 2007. "Second look at the spread of epidemics on networks". Physical Review E, 76(3 Pt 2): 036113. doi:10.1103/PhysRevE.76.036113

On herd immunity

Garnett, G.P. 2005. "Role of herd immunity in determining the effect of vaccines against sexually transmitted disease". The Journal of Infectious Diseases, 191(1): S97-106. doi:10.1086/425271

See Also

Other measures: measure_accuracy_net, measure_accuracy_node, measure_assort_net, measure_assort_node, measure_breadth, measure_broker_node, measure_broker_tie, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_central_tie_between, measure_central_tie_close, measure_central_tie_degree, measure_central_tie_eigen, measure_closure, measure_closure_node, measure_cohesion, measure_core, measure_diffusion_infection, measure_diffusion_node, measure_diverse_net, measure_diverse_node, measure_diverse_tie, measure_features, measure_fit, measure_fragmentation, measure_hierarchy, measure_periods

Other diffusion: mark_diff, measure_diffusion_infection, measure_diffusion_node, member_diffusion, motif_exposure, motif_hazard

Examples

smeg <- generate_smallworld(15, 0.025)
  smeg_diff <- play_diffusion(smeg, recovery = 0.2)
  plot(smeg_diff)
  # To calculate the average transmissibility for a given diffusion model
  net_by_transmissibility(smeg_diff)
  # To calculate the average infection length for a given diffusion model
  net_by_recovery(smeg_diff)
  # To calculate the reproduction number for a given diffusion model
  net_by_reproduction(smeg_diff)
  # Calculating the proportion required to achieve herd immunity
  net_by_immunity(smeg_diff)
  # To find the number of nodes to be vaccinated
  net_by_immunity(smeg_diff, normalized = FALSE)

Measures of nodes in a diffusion

Description

These functions allow measurement of various features of a diffusion process:

  • node_by_adopt_time(): Measures the number of time steps until nodes adopt/become infected

  • node_by_adopt_threshold(): Measures nodes' thresholds from the amount of exposure they had when they became infected

  • node_by_adopt_recovery(): Measures the average length nodes that become infected remain infected in a compartmental model with recovery

  • node_by_adopt_exposure(): Measures how many exposures nodes have to a given mark

Usage

node_by_adopt_time(.data)

node_by_adopt_threshold(.data, normalized = TRUE, lag = 1)

node_by_adopt_recovery(.data)

node_by_adopt_exposure(.data, mark, time = 0)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

normalized

Logical scalar, whether scores are normalized. Different denominators may be used depending on the measure, whether the object is one-mode or two-mode, and other arguments. By default TRUE.

lag

The number of time steps back upon which the thresholds are inferred.

mark

A valid 'node_mark' object or logical vector (TRUE/FALSE) of length equal to the number of nodes in the network.

time

A time point until which infections/adoptions should be identified. By default time = 0.

Value

A node_measure numeric vector the length of the nodes in the network, providing the scores for each node. If the network is labelled, then the scores will be labelled with the nodes' names.

The object also carries the measure it computed, the range its values can fall within, and whether and how those values were normalized. These are shown as a one-line header when the object is printed. Where a measure offers a choice between several ways of counting the same thing, it also carries the variant it used. All can be retrieved with attr().

Adoption time

node_by_adopt_time() measures the time units it took until each node became infected. Note that an adoption time of 0 indicates that this was a seed node.

Thresholds

node_by_adopt_threshold() infers nodes' thresholds based on how much exposure they had when they were infected. This inference is of course imperfect, especially where there is a sudden increase in exposure, but it can be used heuristically. In a threshold model, nodes activate when ∑j:activewji≥θi\sum_{j:\text{active}} w_{ji} \geq \theta_i, where ww is some (potentially weighted) matrix, jj are some already activated nodes, and thetatheta is some pre-defined threshold value. Where a fractional threshold is used, the equation is ∑j:activewji∑jwji≥θi\frac{\sum_{j:\text{active}} w_{ji}}{\sum_{j} w_{ji}} \geq \theta_i. That is, thetatheta is now a proportion, and works regardless of whether ww is weighted or not.

Recovery

node_by_adopt_recovery() measures the average length of time that nodes that become infected remain infected in a compartmental model with recovery. Infections that are not concluded by the end of the study period are calculated as infinite.

Exposure

node_exposure() calculates the number of infected/adopting nodes to which each susceptible node is exposed. It usually expects network data and an index or mark (TRUE/FALSE) vector of those nodes which are currently infected, but if a diff_model is supplied instead it will return nodes exposure at t=0t = 0.

References

On diffusion measures

Valente, Tom W. 1995. Network models of the diffusion of innovations (2nd ed.). Cresskill N.J.: Hampton Press.

See Also

Other diffusion: mark_diff, measure_diffusion_infection, measure_diffusion_net, member_diffusion, motif_exposure, motif_hazard

Other measures: measure_accuracy_net, measure_accuracy_node, measure_assort_net, measure_assort_node, measure_breadth, measure_broker_node, measure_broker_tie, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_central_tie_between, measure_central_tie_close, measure_central_tie_degree, measure_central_tie_eigen, measure_closure, measure_closure_node, measure_cohesion, measure_core, measure_diffusion_infection, measure_diffusion_net, measure_diverse_net, measure_diverse_node, measure_diverse_tie, measure_features, measure_fit, measure_fragmentation, measure_hierarchy, measure_periods

Other nodal: mark_core, mark_degree, mark_diff, mark_nodes, mark_select_node, measure_accuracy_node, measure_assort_node, measure_broker_node, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_closure_node, measure_core, measure_diverse_node, member_brokerage, member_cliques, member_community, member_community_hier, member_community_modular, member_community_partition, member_community_spread, member_components, member_core, member_diffusion, member_equivalence, motif_accuracy_node, motif_brokerage_node, motif_clique, motif_composition, motif_exposure, motif_node, motif_path

Examples

smeg <- generate_smallworld(15, 0.025)
  smeg_diff <- play_diffusion(smeg, recovery = 0.2)
  plot(smeg_diff)
  # To measure when nodes adopted a diffusion/were infected
  (times <- node_by_adopt_time(smeg_diff))
  # To infer nodes' thresholds
  node_by_adopt_threshold(smeg_diff)
  # To measure how long each node remains infected for
  node_by_adopt_recovery(smeg_diff)
  # To measure how much exposure nodes have to a given mark
  node_by_adopt_exposure(smeg, mark = c(1,3))
  node_by_adopt_exposure(smeg_diff)

Measures of network diversity

Description

These functions offer ways to measure the heterogeneity of an attribute across a network, within groups of a network, or the distribution of ties across this attribute:

  • net_by_richness() measures the number of unique categories in a network attribute.

  • net_by_diversity() measures the heterogeneity of ties across a network. Where a membership is given, it instead measures the heterogeneity within each group, as the mean over the groups weighted by their size, such as for the groups from node_in_roulette().

Usage

net_by_richness(.data, attribute)

net_by_diversity(
  .data,
  attribute,
  diversity = c("blau", "teachman", "variation", "gini"),
  membership = NULL
)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

attribute

Name of a nodal attribute, mark, measure, or membership vector.

diversity

Which method to use for ⁠*_diversity()⁠. Either "blau" (Blau's index) or "teachman" (Teachman's index) for categorical attributes, or "variation" (coefficient of variation) or "gini" (Gini coefficient) for numeric attributes. Default is "blau". If an incompatible method is chosen for the attribute type, a suitable alternative will be used instead with a message.

membership

A character string naming an existing node attribute in the network, or a categorical vector of the same length as the number of nodes in the network where each element indicates the group membership of the corresponding node. While this may often be a vector created using ⁠node_in_*()⁠ functions, it can be any character vector that assigns nodes to groups or categories.

Value

A network_measure numeric score.

The object also carries the measure it computed, the range its values can fall within, and whether and how those values were normalized. These are shown as a one-line header when the object is printed. Where a measure offers a choice between several ways of counting the same thing, it also carries the variant it used. All can be retrieved with attr().

Richness

Richness is a simple count of the number of different categories present for a given attribute.

Diversity

Blau's index (1977) uses a formula known also in other disciplines by other names (Gini-Simpson Index, Gini impurity, Gini's diversity index, Gibbs-Martin index, and probability of interspecific encounter (PIE)):

1−∑i=1kpi21 - \sum\limits_{i = 1}^k {p_i^2 }

where pip_i is the proportion of group members in iith category and kk is the number of categories for an attribute of interest. This index can be interpreted as the probability that two members randomly selected from a group would be from different categories. This index finds its minimum value (0) when there is no variety, i.e. when all individuals are classified in the same category. The maximum value depends on the number of categories and whether nodes can be evenly distributed across categories.

The Herfindahl-Hirschman index (HHI) is the complement of Blau's index, ∑i=1kpi2\sum\limits_{i = 1}^k {p_i^2}, and so 1 - net_by_diversity(.data, attribute) returns it. Where shares are stated as percentages rather than proportions, as in the {hhi} package, the index runs from 0 to 10000 and equals (1 - blau) * 10000. Both readings hold for a categorical attribute, where a share is the frequency of a category, which is why neither index is offered for a numeric one.

Teachman's index (1980) is based on information theory and is calculated as:

−∑i=1kpilog⁡(pi)- \sum\limits_{i = 1}^k {p_i \log(p_i)}

where pip_i is the proportion of group members in iith category and kk is the number of categories for an attribute of interest. This index finds its minimum value (0) when there is no variety, i.e. when all individuals are classified in the same category. The maximum value depends on the number of categories and whether nodes can be evenly distributed across categories. It thus shares similar properties to Blau's index, but includes also a notion of richness that tends to give more weight to rare categories and thus tends to highlight imbalances more.

The coefficient of variation (CV) is a standardised measure of dispersion of a probability distribution or frequency distribution. It is defined as the ratio of the standard deviation σ\sigma to the mean μ\mu:

CV=σμCV = \frac{\sigma}{\mu}

It is often expressed as a percentage. The CV is useful because the standard deviation of data must always be understood in the context of the mean of the data. The CV is particularly useful when comparing the degree of variation from one data series to another, even if the means are drastically different from each other.

The Gini coefficient is a measure of statistical dispersion that is intended to represent the income or wealth distribution of a nation's residents, and is commonly used as a measure of inequality. It is defined as a ratio with values between 0 and 1, where 0 corresponds with perfect equality (everyone has the same income) and 1 corresponds with perfect inequality (one person has all the income, and everyone else has zero income). The Gini coefficient can be calculated from the Lorenz curve, which plots the proportion of the total income of the population that is cumulatively earned by the bottom x% of the population. The Gini coefficient is defined as the area between the line of equality and the Lorenz curve, divided by the total area under the line of equality.

References

On richness

Magurran, Anne E. 1988. Ecological Diversity and Its Measurement. Princeton: Princeton University Press. doi:10.1007/978-94-015-7358-0

On diversity

Blau, Peter M. 1977. Inequality and heterogeneity. New York: Free Press.

Teachman, Jay D. 1980. Analysis of population diversity: Measures of qualitative variation. Sociological Methods & Research, 8:341-362. doi:10.1177/004912418000800305

Page, Scott E. 2010. Diversity and Complexity. Princeton: Princeton University Press. doi:10.1515/9781400835140

Hirschman, Albert O. 1964. "The paternity of an index". The American Economic Review, 54(5): 761.

See Also

Other diversity: measure_assort_net, measure_assort_node, measure_diverse_node, measure_diverse_tie, motif_composition, motif_homophily

Other measures: measure_accuracy_net, measure_accuracy_node, measure_assort_net, measure_assort_node, measure_breadth, measure_broker_node, measure_broker_tie, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_central_tie_between, measure_central_tie_close, measure_central_tie_degree, measure_central_tie_eigen, measure_closure, measure_closure_node, measure_cohesion, measure_core, measure_diffusion_infection, measure_diffusion_net, measure_diffusion_node, measure_diverse_node, measure_diverse_tie, measure_features, measure_fit, measure_fragmentation, measure_hierarchy, measure_periods

Examples

net_by_richness(ison_networkers)
marvel_friends <- to_unsigned(to_uniplex(fict_marvel, "relationship"), "positive")
net_by_diversity(marvel_friends, "Gender")
net_by_diversity(marvel_friends, "Appearances")
net_by_diversity(marvel_friends, "Gender",
  membership = node_in_roulette(marvel_friends, groups = 3, attribute = "Gender"))

Measures of node diversity

Description

These functions offer ways to measure the heterogeneity of an attribute across a network, within groups of a network, or the distribution of ties across this attribute:

  • node_by_richness() measures the number of unique categories of an attribute to which each node is connected.

  • node_by_diversity() measures the heterogeneity of each node's alters, not including the node itself. Nodes without alters return NA.

Usage

node_by_richness(.data, attribute)

node_by_diversity(
  .data,
  attribute,
  diversity = c("blau", "teachman", "variation", "gini")
)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

attribute

Name of a nodal attribute, mark, measure, or membership vector.

diversity

Which method to use for ⁠*_diversity()⁠. Either "blau" (Blau's index) or "teachman" (Teachman's index) for categorical attributes, or "variation" (coefficient of variation) or "gini" (Gini coefficient) for numeric attributes. Default is "blau". If an incompatible method is chosen for the attribute type, a suitable alternative will be used instead with a message.

Value

A node_measure numeric vector the length of the nodes in the network, providing the scores for each node. If the network is labelled, then the scores will be labelled with the nodes' names.

The object also carries the measure it computed, the range its values can fall within, and whether and how those values were normalized. These are shown as a one-line header when the object is printed. Where a measure offers a choice between several ways of counting the same thing, it also carries the variant it used. All can be retrieved with attr().

See Also

Other diversity: measure_assort_net, measure_assort_node, measure_diverse_net, measure_diverse_tie, motif_composition, motif_homophily

Other measures: measure_accuracy_net, measure_accuracy_node, measure_assort_net, measure_assort_node, measure_breadth, measure_broker_node, measure_broker_tie, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_central_tie_between, measure_central_tie_close, measure_central_tie_degree, measure_central_tie_eigen, measure_closure, measure_closure_node, measure_cohesion, measure_core, measure_diffusion_infection, measure_diffusion_net, measure_diffusion_node, measure_diverse_net, measure_diverse_tie, measure_features, measure_fit, measure_fragmentation, measure_hierarchy, measure_periods

Other nodal: mark_core, mark_degree, mark_diff, mark_nodes, mark_select_node, measure_accuracy_node, measure_assort_node, measure_broker_node, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_closure_node, measure_core, measure_diffusion_node, member_brokerage, member_cliques, member_community, member_community_hier, member_community_modular, member_community_partition, member_community_spread, member_components, member_core, member_diffusion, member_equivalence, motif_accuracy_node, motif_brokerage_node, motif_clique, motif_composition, motif_exposure, motif_node, motif_path

Examples

node_by_richness(ison_networkers, "Discipline")
marvel_friends <- to_unsigned(to_uniplex(fict_marvel, "relationship"), "positive")
node_by_diversity(marvel_friends, "Gender")
node_by_diversity(marvel_friends, "Attractive")

Measures of tie diversity

Description

  • tie_by_diversity() measures the heterogeneity of the nodes that each tie joins. For a tie between two nodes, this is the diversity of its two ends. For a hypergraph, it is the diversity of the members of each hyperedge, and these are the values that node_by_diversity() gives the hyperedges in the two-mode form of the hypergraph. A tie without members returns NA. A summary of the tie measure then describes the network as a whole.

Usage

tie_by_diversity(
  .data,
  attribute,
  diversity = c("blau", "teachman", "variation", "gini")
)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

attribute

Name of a nodal attribute, mark, measure, or membership vector.

diversity

Which method to use for ⁠*_diversity()⁠. Either "blau" (Blau's index) or "teachman" (Teachman's index) for categorical attributes, or "variation" (coefficient of variation) or "gini" (Gini coefficient) for numeric attributes. Default is "blau". If an incompatible method is chosen for the attribute type, a suitable alternative will be used instead with a message.

Value

A tie_measure numeric vector the length of the ties in the network, providing the scores for each tie. If the network is labelled, then the scores will be labelled with the ties' adjacent nodes' names.

The object also carries the measure it computed, the range its values can fall within, and whether and how those values were normalized. These are shown as a one-line header when the object is printed. Where a measure offers a choice between several ways of counting the same thing, it also carries the variant it used. All can be retrieved with attr().

See Also

Other diversity: measure_assort_net, measure_assort_node, measure_diverse_net, measure_diverse_node, motif_composition, motif_homophily

Other measures: measure_accuracy_net, measure_accuracy_node, measure_assort_net, measure_assort_node, measure_breadth, measure_broker_node, measure_broker_tie, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_central_tie_between, measure_central_tie_close, measure_central_tie_degree, measure_central_tie_eigen, measure_closure, measure_closure_node, measure_cohesion, measure_core, measure_diffusion_infection, measure_diffusion_net, measure_diffusion_node, measure_diverse_net, measure_diverse_node, measure_features, measure_fit, measure_fragmentation, measure_hierarchy, measure_periods

Other tie: mark_dyads, mark_select_tie, mark_ties, mark_triangles, measure_broker_tie, measure_central_tie_between, measure_central_tie_close, measure_central_tie_degree, measure_central_tie_eigen, member_community_link

Examples

tie_by_diversity(ison_lawfirm, "gender")
tie_by_diversity(to_hypergraph(ison_southern_women), "Title")

Measures of network topological features

Description

These functions measure topological features that are intrinsic to a network, in the sense that they require nothing of the user beyond the network itself:

  • net_by_richclub() measures the rich-club coefficient of a network.

  • net_by_smallworld() measures the small-world coefficient for one- or two-mode networks. Small-world networks can be highly clustered and yet have short path lengths.

  • net_by_scalefree() measures the exponent of a fitted power-law distribution. An exponent between 2 and 3 usually indicates a power-law distribution.

  • net_by_balance() measures the structural balance index on the proportion of balanced triangles, ranging between 0 if all triangles are imbalanced and 1 if all triangles are balanced.

  • net_by_bipartivity() measures how close a network is to being bipartite, that is, to dividing into two sets with ties only between them.

  • net_by_meshedness() measures how many cycles a network has, relative to the most that a planar network of its size could have. A tree scores 0, and a network of triangles drawn on a plane scores 1.

Usage

net_by_richclub(.data)

net_by_smallworld(
  .data,
  variant = c("omega", "sigma", "SWI"),
  times = 100,
  method = NULL
)

net_by_scalefree(.data)

net_by_bipartivity(.data)

net_by_meshedness(.data)

net_by_balance(.data)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

variant

Character string naming which variant of the measure to compute, where more than one definition of the same quantity is in use. The variant chosen is reported when the result is printed.

times

Integer of number of simulations.

method

Deprecated. The former spelling of variant. Still accepted, but warns; please use variant instead.

Value

A network_measure numeric score.

The object also carries the measure it computed, the range its values can fall within, and whether and how those values were normalized. These are shown as a one-line header when the object is printed. Where a measure offers a choice between several ways of counting the same thing, it also carries the variant it used. All can be retrieved with attr().

Small-world variants

For net_by_smallworld() there are three small-world measures implemented:

  • "sigma" is the original equation from Watts and Strogatz (1998),

    CCrLLr\frac{\frac{C}{C_r}}{\frac{L}{L_r}}

    , where CC and LL are the observed clustering coefficient and path length, respectively, and CrC_r and LrL_r are the averages obtained from random networks of the same dimensions and density. A σ>1\sigma > 1 is considered to be small-world, but this measure is highly sensitive to network size.

  • "omega" (the default) is an update from Telesford et al. (2011),

    LrL−CCl\frac{L_r}{L} - \frac{C}{C_l}

    , where ClC_l is the clustering coefficient for a ring lattice with the same number of nodes and about the same number of ties. ω\omega ranges between -1 and 1, where values close to 0 are as close to a small-world as possible; negative values indicate a lattice-like network, and positive values a more random one.

  • "SWI" is an alternative proposed by Neal (2017),

    L−LlLr−Ll×C−CrCl−Cr\frac{L - L_l}{L_r - L_l} \times \frac{C - C_r}{C_l - C_r}

    , where LlL_l is the average path length for the same ring lattice. SWISWI ranges between 0 and 1, where 1 is as close to a small-world as possible, though there may not be a network for which SWI=1SWI = 1.

Bipartivity

A network is bipartite when its nodes divide into two sets with ties only running between them and never within, which is exactly the condition that it contains no closed walk of odd length. Bipartivity therefore measures how close a network comes to that condition, as the share of its closed walks that are of even length:

b(G)=∑iCeven(i)∑iCall(i)b(G) = \frac{\sum_i C_{even}(i)}{\sum_i C_{all}(i)}

A genuinely two-mode network scores exactly 1, and the more odd-length structure a network carries — triangles above all — the further it falls below 1. Note that this asks whether a network could be split in two, not whether it has been: it is defined on a one-mode network, whereas manynet::is_twomode() reports whether nodes are already partitioned into two modes. The node-level counterpart is node_by_subgraph() with walks = "odd" or "even".

Meshedness

Meshedness, or Kansky's alpha index, counts a network's independent cycles (its circuit rank) relative to the most that a planar network, one that can be drawn on a plane without crossing ties, of the same number of nodes can have:

α=m−n+c2n−5\alpha = \frac{m - n + c}{2n - 5}

where mm is the number of ties, nn the number of nodes, and cc the number of components. It is read on the undirected, simple network, so that direction, loops, and parallel ties are not counted. It distinguishes, for example, tree-like road networks from grids. For a planar network it ranges from 0 to 1, but a network that is not planar can score above 1, so the upper end of its range is declared open. It is not defined for fewer than three nodes, where it returns NA.

Source

{signnet} by David Schoch

References

On the rich-club coefficient

Zhou, Shi, and Raul J. Mondragon. 2004. "The Rich-Club Phenomenon in the Internet Topology". IEEE Communications Letters, 8(3): 180-182. doi:10.1109/lcomm.2004.823426

On small-worldliness

Watts, Duncan J., and Steven H. Strogatz. 1998. “Collective Dynamics of ‘Small-World’ Networks”. Nature 393(6684):440–42. doi:10.1038/30918

Telesford QK, Joyce KE, Hayasaka S, Burdette JH, Laurienti PJ. 2011. "The ubiquity of small-world networks". Brain Connectivity 1(5): 367–75. doi:10.1089/brain.2011.0038

Neal, Zachary P. 2017. "How small is it? Comparing indices of small worldliness". Network Science. 5 (1): 30–44. doi:10.1017/nws.2017.5

On scale-free networks

Barabasi, Albert-Laszlo, and Reka Albert. 1999. "Emergence of scaling in random networks", Science, 286(5439): 509-512. doi:10.1126/science.286.5439.509

Clauset, Aaron, Cosma Rohilla Shalizi, and Mark E.J. Newman. 2009. "Power-law distributions in empirical data", SIAM Review, 51(4): 661-703. doi:10.1137/070710111

Stumpf, Michael P.H., and Mason Porter. 2012. "Critical truths about power laws", Science, 335(6069): 665-666. doi:10.1126/science.1216142

Holme, Petter. 2019. "Rare and everywhere: Perspectives on scale-free networks", Nature Communications, 10(1): 1016. doi:10.1038/s41467-019-09038-8

On bipartivity

Estrada, Ernesto, and Juan A. Rodríguez-Velázquez. 2005. "Spectral measures of bipartivity in complex networks". Physical Review E 72(4): 046105. doi:10.1103/PhysRevE.72.046105

On meshedness

Kansky, Karel J. 1963. Structure of Transportation Networks. Chicago: University of Chicago, Department of Geography.

Buhl, Jerome, Jacques Gautrais, Ricard V. Solé, Pascale Kuntz, Sergi Valverde, Jean-Louis Deneubourg, and Guy Theraulaz. 2004. "Efficiency and robustness in ant networks of galleries". The European Physical Journal B 42(1): 123-129. doi:10.1140/epjb/e2004-00364-9

On balance theory

Heider, Fritz. 1946. "Attitudes and cognitive organization". The Journal of Psychology, 21: 107-112. doi:10.1080/00223980.1946.9917275

Cartwright, D., and Frank Harary. 1956. "Structural balance: A generalization of Heider's theory". Psychological Review, 63(5): 277-293. doi:10.1037/h0046049

See Also

net_by_transitivity() and net_by_equivalency() for how clustering is calculated

Other features: measure_accuracy_net, measure_accuracy_node, measure_fit, motif_accuracy_node

Other measures: measure_accuracy_net, measure_accuracy_node, measure_assort_net, measure_assort_node, measure_breadth, measure_broker_node, measure_broker_tie, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_central_tie_between, measure_central_tie_close, measure_central_tie_degree, measure_central_tie_eigen, measure_closure, measure_closure_node, measure_cohesion, measure_core, measure_diffusion_infection, measure_diffusion_net, measure_diffusion_node, measure_diverse_net, measure_diverse_node, measure_diverse_tie, measure_fit, measure_fragmentation, measure_hierarchy, measure_periods

Examples

net_by_richclub(ison_adolescents)
net_by_smallworld(ison_brandes)
net_by_smallworld(ison_southern_women)
net_by_scalefree(ison_adolescents)
net_by_scalefree(generate_scalefree(50, 1.5))
net_by_scalefree(create_lattice(100))
# A two-mode network is bipartite by construction
net_by_bipartivity(ison_southern_women)
net_by_bipartivity(ison_adolescents)
net_by_meshedness(create_tree(12))
net_by_meshedness(create_lattice(12))
net_by_balance(to_uniplex(fict_marvel, "relationship"))

Measures of how well a structure fits a network

Description

These functions measure how well some proposed structure describes a network. Unlike the intrinsic properties in measure_features, each takes a structure from the user — a core-periphery mark, or a partition of the nodes — and returns how closely the observed network corresponds to it:

  • net_by_core() measures the correlation between a network and a core-periphery model with the same dimensions.

  • net_by_factions() measures the correlation between a network and a component model with the same dimensions.

  • net_by_modularity() measures the modularity of a network based on nodes' membership in defined clusters.

  • net_by_linkdensity() measures the partition density of a network based on ties' membership in defined clusters.

  • net_by_divergence() measures how far a network is from an ideal network, such as a core-periphery, complete, or star network.

  • net_by_inconsistency() measures how far a partition's blocks depart from ideal block types.

These are the natural companions to the ⁠node_in_*()⁠ functions, which propose a structure; these say how good that proposal is. Where a partition is expected but none is given, the network is partitioned into two using node_in_partition().

Note that they are not on a common scale, and do not all run in the same direction, so they are not interchangeable:

measure compares the network against range better
net_by_core() a core-periphery model -1 to 1 higher
net_by_factions() a components model -1 to 1 higher
net_by_modularity() the partition's communities -0.5 to 1 (at the default resolution) higher
net_by_linkdensity() the partition's communities of ties -1/3 to 1 higher
net_by_divergence() an ideal network 0 to 1 lower
net_by_inconsistency() ideal block types 0 upwards lower

Compare partitions using one measure at a time.

Usage

net_by_core(
  .data,
  mark = NULL,
  variant = c("correlation", "ident", "ndiff", "diff"),
  coreness = NULL,
  direction = c("all", "out", "in"),
  method = NULL
)

net_by_factions(.data, membership = NULL)

net_by_modularity(.data, membership = NULL, resolution = 1)

net_by_linkdensity(.data, membership = NULL)

net_by_divergence(
  .data,
  ideal = manynet::create_core,
  variant = c("hamming", "jaccard", "portrait"),
  mark = NULL,
  membership = NULL
)

net_by_inconsistency(.data, membership = NULL, blocks = c("nul", "com"))

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

mark

A logical vector indicating which nodes belong to the core.

variant

Character string naming which variant of the measure to compute, where more than one definition of the same quantity is in use. The variant chosen is reported when the result is printed.

coreness

Which method to use to calculate nodes' coreness. One of "correlation", "rich", "transition", or "hub"; see method_coreness for what each does. By default NULL, which uses "rich" for a weighted, directed, or two-mode network, since it is the only method that reads those properties directly, and "correlation" otherwise.

direction

One of "all" (the default), "out", or "in". For a directed network, "out" scores nodes on the ties they send and "in" on the ties they receive. Ignored for undirected and two-mode networks.

method

Deprecated. The former spelling of variant. Still accepted, but warns; please use variant instead.

membership

A character string naming an existing node attribute in the network, or a categorical vector of the same length as the number of nodes in the network where each element indicates the group membership of the corresponding node. While this may often be a vector created using ⁠node_in_*()⁠ functions, it can be any character vector that assigns nodes to groups or categories.

resolution

A proportion indicating the resolution scale. By default 1, which returns the original definition of modularity. The higher this parameter, the more smaller communities will be privileged. The lower this parameter, the fewer larger communities are likely to be found.

ideal

The ideal network to compare against. Either a network object, or a function that builds one from the network, such as any of the ⁠manynet::create_*()⁠ or ⁠manynet::generate_*()⁠ functions. A function is called with the network as its first argument, and also given mark or membership where it takes them. By default manynet::create_core(). For other arguments, pass an anonymous function, e.g. ⁠\(x) manynet::create_lattice(x, width = 4)⁠.

blocks

A character vector of permitted ideal block types, or a list-matrix giving the permitted types for each block position. By default c("nul", "com"), which is structural blockmodelling. See the section below.

Details

For multilevel networks, net_by_core() and net_by_factions() stop rather than compare unlike shapes. They fit the network to an ideal built by a ⁠manynet::create_*()⁠ function, and those build one layer at a time. A multilevel network holds two, so there is no single ideal to fit it to. Take one layer first, e.g. with manynet::to_mode1() or manynet::to_uniplex().

Value

A network_measure numeric score.

The object also carries the measure it computed, the range its values can fall within, and whether and how those values were normalized. These are shown as a one-line header when the object is printed. Where a measure offers a choice between several ways of counting the same thing, it also carries the variant it used. All can be retrieved with attr().

Core-periphery fit variants

For net_by_core(), which of the following to use to calculate the fit of the core assignment to a core-periphery model. "correlation" calculates the correlation between the empirical network and an ideal typical network, and "ident" calculates the Euclidean distances between the same. "ndiff", however, calculates how distinct the core and periphery groups are based on the difference in coreness scores between the least core-like member of the core and the most core-like member of the periphery. "diff" is similar to "ndiff", but multiplies the raw "ndiff" score by the square root of the size of the core, thus penalising large cores.

Core-Periphery

net_by_core() calculates the Pearson correlation between the given network, where the nodes in the core are assigned by some given mark, and an ideal typical core-periphery network with the same number of nodes in the core and the periphery.

Where mark is not given, it is calculated with node_is_core(), to which the coreness and direction arguments are passed. For a directed network the fit itself is measured on the symmetrised network, since the ideal it is compared against is symmetric.

Modularity

Modularity measures the difference between the number of ties within each community from the number of ties expected within each community in a random graph with the same degrees. At the default resolution it ranges between -0.5 and +1; a higher resolution can push it further below that floor. Modularity scores approaching +1 mean that ties only appear within communities, while negative scores mean that ties appear between communities more often than chance would predict. A score of 0 would mean that ties are half within and half between communities, as one would expect in a random graph.

Modularity faces a difficult problem known as the resolution limit (Fortunato and Barthélemy 2007). This problem appears when optimising modularity, particularly with large networks or depending on the degree of interconnectedness, can miss small clusters that 'hide' inside larger clusters. In the extreme case, this can be where they are only connected to the rest of the network through a single tie. To help manage this problem, a resolution parameter is added. Please see the argument definition for more details.

For signed networks, net_by_modularity() returns signed modularity (Gómez, Jensen, and Arenas 2009). The positive and the negative ties are each compared with their own random baseline, and the negative score is subtracted, so that a negative tie inside a group counts against the partition and a negative tie between groups counts for it. It ranges between -1 and 1, and is the quality that node_in_spinglass() maximises on a signed network. A directed signed network is read as undirected, and a signed two-mode network is read by the magnitude of its ties.

Link density

net_by_linkdensity() measures the partition density of a membership of the network's ties, such as that from tie_in_community(), which is used where no membership is given. Each community's density is the number of its ties beyond those that a tree over its nodes needs, as a share of the ties that would make those nodes a clique. The partition density is the mean of these, weighted by the number of ties in each community (Ahn et al. 2010). It is 1 where every community is a clique, 0 where every community is a tree, and negative only where the ties of a community do not connect. Ties between the same two nodes count once, and ties without a membership are left out.

Divergence

net_by_divergence() measures how far a network is from some ideal network, from 0 where the network is the ideal to 1. There are three variants:

  • "hamming" (the default) is the share of possible ties on which the network and the ideal disagree. This is the graph edit distance, counting only tie additions and deletions, normalised by the number of possible ties. A missing tie that is also missing in the ideal counts as agreement.

  • "jaccard" is one minus the share of ties in either network that are in both. Unlike "hamming", it ignores ties missing from both, so a sparse network does not look close to a sparse ideal just because both are sparse. For the same reason it is always 1 against an empty ideal, so use "hamming" there.

  • "portrait" is the portrait divergence of Bagrow and Bollt (2019): the Jensen-Shannon divergence between the two networks' distributions of how many nodes each node reaches at each distance. It compares structure at all scales and needs no correspondence between the two networks' nodes, so the ideal may even be of a different size.

"hamming" and "jaccard" compare the two networks tie by tie, and so need the ideal's nodes to correspond to the network's. This holds for an ideal network of the same dimensions and node names, and for manynet::create_core(), manynet::create_components(), manynet::create_filled(), and manynet::create_empty(), which are built from the network's own mark or membership, or do not depend on the order of nodes. It does not hold for, e.g., manynet::create_star() or manynet::create_ring(), where which node is the hub or comes next is arbitrary, nor for the random ⁠manynet::generate_*()⁠ functions. There the portrait divergence is used instead, and the result reports the variant used. Note that an ideal from a ⁠manynet::generate_*()⁠ function is random, so it returns a different value on each call.

Where a directed network is compared tie by tie with manynet::create_core() or manynet::create_components(), which build one direction only, both are first symmetrised, as in net_by_core().

Divergence and inconsistency

net_by_divergence() and net_by_inconsistency() both return how far a network is from an ideal, and both run lower-is-better, but they differ in what that ideal is:

  • net_by_divergence() compares against one ideal network, and returns a value between 0 and 1.

  • net_by_inconsistency() compares against the best of a set of ideals. Each block may take whichever of the permitted types fits it best, so the data choose the image. Some of those types, such as reg, are satisfied by many different blocks rather than by one, so there is no single network to compare against. Its value runs from 0 upwards.

Where every block of a membership is best fitted as complete on the diagonal and null off it, net_by_inconsistency(blocks = c("nul", "com")) equals the "hamming" divergence from manynet::create_components(membership = membership). In short, use net_by_divergence() where you can name the ideal network, and net_by_inconsistency() where you can only name the permitted block types.

Blockmodelling

A blockmodel proposes that a partition reduces a network to a small number of positions, so that every block — the ties running from one position to another — is of some simple ideal type. net_by_inconsistency() measures how far the network departs from that proposal, by counting the ties that would have to be added or removed to make every block ideal, normalized by the number of cells. Lower is better: 0 means the partition fits perfectly.

This is a distance from an ideal image rather than a measure of fit — hence the name, and hence its running the opposite way to the rest of this page. Three consequences are worth knowing:

  • Its complement is not a proportion. The criterion mixes units: nul and com count cells, while reg counts empty rows and columns, and all are divided by the cell count. So do not read 1−x1 - x as the share of the network that the blockmodel gets right.

  • It is not bounded above by 1. That holds only for cell-counting vocabularies such as c("nul", "com"). With reg permitted it can exceed 1 — on ison_adolescents, blocks = "reg" over singleton positions reaches about 1.57.

  • The vocabularies behave very differently at fine partitions. Giving every node its own position scores 0 under c("nul", "com"), since each block is then a single cell and trivially ideal, but scores its worst under "reg", since each block then has an empty row and column.

For a correlation-scaled, higher-is-better reading of the common structural case, see net_by_factions(). The two are related but not equivalent: net_by_factions() fixes the image — complete on the diagonal, null off it — whereas net_by_inconsistency(blocks = c("nul", "com")) lets each block take whichever of the two ideals fits it better, and so is more permissive. For how it relates to net_by_divergence(), which also runs lower-is-better, see the section on divergence and inconsistency.

The ideal types are:

nul

a null block, containing no ties.

com

a complete block, containing every possible tie.

reg

a regular block, in which every row and every column has at least one tie, though not necessarily all of them.

rdo, cdo

a row- or column-dominant block, containing at least one complete row or column.

dnc

"do not care": a block left unconstrained.

blocks is a vocabulary rather than an assignment: each block is scored at the lowest inconsistency of any permitted type, and the results summed. Any subset may be given, and the two conventional choices are c("nul", "com") for structural equivalence and c("nul", "reg") for regular equivalence.

Note that permitting more types can only lower the criterion, since each block gains more ways to be satisfied. The size of the vocabulary is therefore itself a modelling choice, and criterion values are comparable across partitions only when the same vocabulary is used for each.

For fully generalized blockmodelling, pass a g by g list-matrix naming the types permitted at each position separately, e.g. reg on the diagonal and nul off it for a "cohesive positions" model.

References

On signed modularity

Gómez, Sergio, Pablo Jensen, and Alex Arenas. 2009. "Analysis of community structure in networks of correlated data". Physical Review E 80: 016114. doi:10.1103/PhysRevE.80.016114

On core-periphery

Borgatti, Stephen P., and Martin G. Everett. 2000. “Models of Core/Periphery Structures.” Social Networks 21(4):375–95. doi:10.1016/S0378-8733(99)00019-2

On modularity

Newman, Mark E.J. 2006. "Modularity and community structure in networks", Proceedings of the National Academy of Sciences 103(23): 8577-8696. doi:10.1073/pnas.0601602103

Murata, Tsuyoshi. 2010. "Modularity for Bipartite Networks". In: Memon, N., Xu, J., Hicks, D., Chen, H. (eds) Data Mining for Social Network Data. Annals of Information Systems, Vol 12. Springer, Boston, MA. doi:10.1007/978-1-4419-6287-4_7

On link density

Ahn, Yong-Yeol, James P. Bagrow, and Sune Lehmann. 2010. "Link communities reveal multiscale complexity in networks". Nature 466(7307): 761-764. doi:10.1038/nature09182

On portrait divergence

Bagrow, James P., and Erik M. Bollt. 2019. "An information-theoretic, all-scales approach to comparing networks". Applied Network Science 4: 45. doi:10.1007/s41109-019-0156-x

On generalized blockmodelling

Doreian, Patrick, Vladimir Batagelj, and Anuska Ferligoj. 2005. Generalized Blockmodeling. Cambridge: Cambridge University Press. doi:10.1017/CBO9780511584176

See Also

Other features: measure_accuracy_net, measure_accuracy_node, measure_features, motif_accuracy_node

Other measures: measure_accuracy_net, measure_accuracy_node, measure_assort_net, measure_assort_node, measure_breadth, measure_broker_node, measure_broker_tie, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_central_tie_between, measure_central_tie_close, measure_central_tie_degree, measure_central_tie_eigen, measure_closure, measure_closure_node, measure_cohesion, measure_core, measure_diffusion_infection, measure_diffusion_net, measure_diffusion_node, measure_diverse_net, measure_diverse_node, measure_diverse_tie, measure_features, measure_fragmentation, measure_hierarchy, measure_periods

Examples

net_by_core(ison_adolescents)
net_by_core(ison_southern_women)
  net_by_factions(ison_southern_women)
net_by_modularity(ison_adolescents, 
  node_in_partition(ison_adolescents))
net_by_modularity(ison_southern_women, 
  node_in_partition(ison_southern_women))
net_by_linkdensity(ison_adolescents,
  tie_in_community(ison_adolescents))
net_by_divergence(ison_adolescents, manynet::create_filled)
net_by_divergence(ison_adolescents, manynet::create_filled,
                  variant = "jaccard")
net_by_divergence(ison_adolescents, manynet::create_star)
net_by_inconsistency(ison_hightech, node_in_regular(ison_hightech))
# a regular-equivalence vocabulary instead of a structural one
net_by_inconsistency(ison_hightech, node_in_structural(ison_hightech), 
       blocks = c("nul", "reg"))

Measures of network fragmentation

Description

These functions return values relating to how connected a network is and the number of nodes or edges to remove that would increase fragmentation.

  • net_by_cohesion() measures the minimum number of nodes to remove from the network needed to increase the number of components.

  • net_by_toughness() measures the number of nodes that would need to be removed from a network to increase its number of components.

  • net_by_adhesion() measures the minimum number of ties to remove from the network needed to increase the number of components, or the minimum total weight of such ties in a weighted network.

  • net_by_strength() measures the number of ties that would need to be removed from a network to increase its number of components.

  • net_by_robustness() measures how slowly the network's largest component shrinks as its nodes are removed one at a time, either at random or in order of some node measure.

Usage

net_by_cohesion(.data)

net_by_adhesion(.data)

net_by_strength(.data, limit = 20)

net_by_toughness(.data, limit = 20)

net_by_robustness(.data, node_measure = NULL, times = 100)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

limit

The largest network net_by_strength() and net_by_toughness() will enumerate: the number of ties for the first and of nodes for the second. By default 20. Above this each stops rather than running for hours. Raise it to measure a larger network anyway.

node_measure

How the nodes to remove are chosen. By default NULL, which removes nodes at random, so that the network suffers failure rather than attack. Otherwise, at each step the node that node_is_max() marks is removed, choosing at random among any tied for the maximum. Give a ⁠node_by_*()⁠ function, such as node_by_degree, to recompute the measure on the network remaining after each removal, which is an adaptive attack. Give a node_measure object, such as node_by_degree(.data), to remove nodes in the order of the scores the intact network gives them, which is a static attack. To pass further arguments, give a function of the network, e.g. ⁠\(x) node_by_closeness(x, normalized = FALSE)⁠.

times

Integer scalar, how many times the algorithm repeats its work. Where the algorithm is stochastic, this is how many times it runs, and the best or the most frequent result is kept. Where the algorithm searches, this is how many steps the search takes. More repetitions give a more reliable result and take longer, so each function documents its own default.

Details

For weighted networks, net_by_adhesion() reads a tie's weight as its capacity, and so returns the smallest total weight of ties whose removal would increase the number of components, the network's minimum cut, rather than the smallest number of such ties. This is also the smallest maximum flow between any two of its nodes; see node_by_flow() for the flow between particular nodes. Use manynet::to_unweighted() first to count ties instead. The other measures documented here count nodes or ties whatever their weight.

For signed networks, net_by_adhesion() considers only the positive ties, and says so. It asks what holds a network together, and a negative tie is hostility rather than a channel along which cohesion travels. Use manynet::to_unsigned() first to control this yourself. net_by_robustness() also considers only the positive ties. The other measures documented here use every tie whatever its sign.

Value

A network_measure numeric score.

The object also carries the measure it computed, the range its values can fall within, and whether and how those values were normalized. These are shown as a one-line header when the object is printed. Where a measure offers a choice between several ways of counting the same thing, it also carries the variant it used. All can be retrieved with attr().

Cost of the enumerated measures

net_by_cohesion() and net_by_adhesion() are connectivity problems that {igraph} solves directly, so they run on a network of any size. net_by_strength() and net_by_toughness() instead take a minimum over every subset of the tieset or the nodeset, which is 2n2^n subsets. Their cost therefore quadruples for every two nodes added: a ring of 16 nodes takes about 8 seconds, one of 20 over two minutes, and one of 30 more than a day. limit stops each before it becomes a hang.

Robustness

net_by_robustness() removes the nodes of a network one at a time, recording after each removal the share of the original nodes that remain in the largest weak component. It returns the mean of these shares over all NN removals, Schneider et al.'s RR. A star attacked at its hub falls apart at once, scoring about 1/N1/N, while a complete network loses only one node with each removal, scoring (N−1)/2N(N-1)/2N, which approaches the maximum of 0.5. Comparing a random failure against an attack shows, as Albert, Jeong and Barabási found, that a network with a few hubs tolerates failure but is fragile under attack.

The share remaining after each number of removals is kept as the curve attribute of the result, a table with columns removed, the share of the nodes removed, and giant, the share of the original nodes in the largest component, averaged over the times runs. Retrieve it with attr(x, "curve").

Nodes are chosen at random wherever several are tied, so the result is averaged over times runs, by default 100. Where an attack meets no ties, every run would be the same, so it runs once. Each run computes the measure once per node removed, so an adaptive attack by an expensive measure, such as betweenness, on a network of several hundred nodes can take some minutes. Lower times, or attack with a node_measure object, to go faster.

For signed networks, net_by_robustness() considers only the positive ties, since a negative tie does not hold a component together.

For two-mode networks, node_is_max() marks the highest-scoring node in each mode, so an attack on a two-mode network chooses at random between the two.

References

On cohesion

White, Douglas R and Frank Harary. 2001. "The Cohesiveness of Blocks In Social Networks: Node Connectivity and Conditional Density." Sociological Methodology 31(1): 305-59. doi:10.1111/0081-1750.00098

On robustness

Albert, Réka, Hawoong Jeong, and Albert-László Barabási. 2000. "Error and attack tolerance of complex networks." Nature 406: 378-82. doi:10.1038/35019019

Schneider, Christian M., André A. Moreira, José S. Andrade, Shlomo Havlin, and Hans J. Herrmann. 2011. "Mitigation of malicious attacks on networks." Proceedings of the National Academy of Sciences 108(10): 3838-41. doi:10.1073/pnas.1009440108

See Also

Other cohesion: mark_triangles, measure_breadth, measure_cohesion, motif_net, motif_node

Other measures: measure_accuracy_net, measure_accuracy_node, measure_assort_net, measure_assort_node, measure_breadth, measure_broker_node, measure_broker_tie, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_central_tie_between, measure_central_tie_close, measure_central_tie_degree, measure_central_tie_eigen, measure_closure, measure_closure_node, measure_cohesion, measure_core, measure_diffusion_infection, measure_diffusion_net, measure_diffusion_node, measure_diverse_net, measure_diverse_node, measure_diverse_tie, measure_features, measure_fit, measure_hierarchy, measure_periods

Examples

net_by_cohesion(fict_greys)
net_by_cohesion(to_giant(fict_greys))
net_by_adhesion(fict_greys)
net_by_adhesion(to_giant(fict_greys))
net_by_strength(ison_adolescents)
net_by_toughness(ison_adolescents)
sf <- generate_scalefree(50, 0.5)
net_by_robustness(sf)
net_by_robustness(sf, node_measure = node_by_degree)

Measures of hierarchy

Description

These functions, together with net_reciprocity(), are used jointly to measure how hierarchical a network is:

  • net_by_connectedness() measures the proportion of dyads in the network that are reachable to one another, or the degree to which network is a single component.

  • net_by_efficiency() measures the Krackhardt efficiency score.

  • net_by_upperbound() measures the Krackhardt (least) upper bound score.

Usage

net_by_connectedness(.data)

net_by_efficiency(.data)

net_by_upperbound(.data)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

Details

For signed networks, these measures consider only the positive ties, and say so. They read a tie as a distance, and a negative tie is hostility rather than a channel along which cohesion travels. Use manynet::to_unsigned() first to control this yourself.

Value

A network_measure numeric score.

The object also carries the measure it computed, the range its values can fall within, and whether and how those values were normalized. These are shown as a one-line header when the object is printed. Where a measure offers a choice between several ways of counting the same thing, it also carries the variant it used. All can be retrieved with attr().

Efficiency

A perfect hierarchy is a tree: every node but the root has exactly one superior, and there are no ties to spare. Krackhardt's efficiency asks how close a network comes to that, by counting the ties it carries in excess of the minimum needed to hold its components together, as a proportion of the most excess ties it could possibly carry:

E=1−∣E∣−∑i(Ni−1)∑i(Mi−(Ni−1))E = 1 - \frac{|E| - \sum_i (N_i - 1)}{\sum_i \left(M_i - (N_i - 1)\right)}

where NiN_i is the size of weak component ii and MiM_i the number of ties possible within it. A tree or forest scores 1, and a complete network 0.

References

On hierarchy

Krackhardt, David. 1994. Graph theoretical dimensions of informal organizations. In Carley and Prietula (eds) Computational Organizational Theory, Hillsdale, NJ: Lawrence Erlbaum Associates. Pp. 89-111.

Everett, Martin, and David Krackhardt. 2012. “A second look at Krackhardt's graph theoretical dimensions of informal organizations.” Social Networks, 34: 159-163. doi:10.1016/j.socnet.2011.10.006

See Also

Other measures: measure_accuracy_net, measure_accuracy_node, measure_assort_net, measure_assort_node, measure_breadth, measure_broker_node, measure_broker_tie, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_central_tie_between, measure_central_tie_close, measure_central_tie_degree, measure_central_tie_eigen, measure_closure, measure_closure_node, measure_cohesion, measure_core, measure_diffusion_infection, measure_diffusion_net, measure_diffusion_node, measure_diverse_net, measure_diverse_node, measure_diverse_tie, measure_features, measure_fit, measure_fragmentation, measure_periods

Other hierarchy: motif_hierarchy

Examples

net_by_connectedness(ison_networkers)
1 - net_by_reciprocity(ison_networkers)
net_by_efficiency(ison_networkers)
net_by_upperbound(ison_networkers)

Measures of network change

Description

net_by_waves() measures the number of waves in longitudinal network data.

Usage

net_by_waves(.data)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

Value

A network_measure numeric score.

The object also carries the measure it computed, the range its values can fall within, and whether and how those values were normalized. These are shown as a one-line header when the object is printed. Where a measure offers a choice between several ways of counting the same thing, it also carries the variant it used. All can be retrieved with attr().

See Also

Other change: motif_periods

Other measures: measure_accuracy_net, measure_accuracy_node, measure_assort_net, measure_assort_node, measure_breadth, measure_broker_node, measure_broker_tie, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_central_tie_between, measure_central_tie_close, measure_central_tie_degree, measure_central_tie_eigen, measure_closure, measure_closure_node, measure_cohesion, measure_core, measure_diffusion_infection, measure_diffusion_net, measure_diffusion_node, measure_diverse_net, measure_diverse_node, measure_diverse_tie, measure_features, measure_fit, measure_fragmentation, measure_hierarchy

Examples

net_by_waves(ison_monks)

Memberships in brokerage positions

Description

node_in_brokering() returns nodes membership as a powerhouse, connector, linchpin, or sideliner according to Hamilton et al. (2020).

Usage

node_in_brokering(.data, membership)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

membership

A character string naming an existing node attribute in the network, or a categorical vector of the same length as the number of nodes in the network where each element indicates the group membership of the corresponding node. While this may often be a vector created using ⁠node_in_*()⁠ functions, it can be any character vector that assigns nodes to groups or categories.

Value

A node_member character vector the length of the nodes in the network, of group memberships "A", "B", etc for each node. If the network is labelled, then the assignments will be labelled with the nodes' names.

References

On brokerage activity and exclusivity

Hamilton, Matthew, Jacob Hileman, and Orjan Bodin. 2020. "Evaluating heterogeneous brokerage: New conceptual and methodological approaches and their application to multi-level environmental governance networks" Social Networks 61: 1-10. doi:10.1016/j.socnet.2019.08.002

See Also

Other brokerage: measure_broker_node, measure_broker_tie, measure_brokerage, motif_brokerage_net, motif_brokerage_node

Other memberships: member_cliques, member_community, member_community_hier, member_community_link, member_community_modular, member_community_partition, member_community_spread, member_components, member_core, member_diffusion, member_equivalence

Other nodal: mark_core, mark_degree, mark_diff, mark_nodes, mark_select_node, measure_accuracy_node, measure_assort_node, measure_broker_node, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_closure_node, measure_core, measure_diffusion_node, measure_diverse_node, member_cliques, member_community, member_community_hier, member_community_modular, member_community_partition, member_community_spread, member_components, member_core, member_diffusion, member_equivalence, motif_accuracy_node, motif_brokerage_node, motif_clique, motif_composition, motif_exposure, motif_node, motif_path

Examples

node_in_brokering(ison_networkers, "Discipline")

Memberships in maximally diverse cliques

Description

These functions create a vector of nodes' memberships in cliques:

  • node_in_roulette() assigns nodes to maximally diverse groups.

Usage

node_in_roulette(
  .data,
  groups,
  group_size,
  times = NULL,
  decay = 1,
  attribute = NULL,
  balance = 0.5,
  num_groups = NULL
)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

groups

An integer indicating the number of groups desired, or a vector of the size of each group, which must sum to the number of nodes. The groups then keep exactly these sizes.

group_size

An integer indicating the desired size of most of the groups. Note that if the number of nodes is not divisible into groups of equal size, there may be some larger or smaller groups.

times

Integer scalar, how many times the algorithm repeats its work. Where the algorithm is stochastic, this is how many times it runs, and the best or the most frequent result is kept. Where the algorithm searches, this is how many steps the search takes. More repetitions give a more reliable result and take longer, so each function documents its own default.

decay

A proportion between 0 and 1 by which a tie in a longitudinal or dynamic network is discounted for each wave or unit of time before the latest. By default 1, so that every earlier tie costs the same.

attribute

Optionally, the name of a node attribute, or a vector with a value for each node, on which the groups should be mixed.

balance

A proportion between 0 and 1 that weighs mixing on the attribute against keeping tied nodes apart. By default 0.5.

num_groups

Deprecated. The former spelling of groups. Still accepted, but warns; please use groups instead.

Details

times defaults to the number of nodes multiplied by the number of groups. This heuristic may be insufficient for small networks and numbers of groups, and burdensome for large ones, but can be overwritten. Each iteration makes a weak perturbation, and keeps it only if it improves the objective function. At every 10th iteration, the search starts again from a stronger perturbation of the best solution so far, a number of successive changes approximately the number of nodes divided by the number of groups.

Value

A node_member character vector the length of the nodes in the network, of group memberships "A", "B", etc for each node. If the network is labelled, then the assignments will be labelled with the nodes' names.

Maximally diverse grouping problem

This well known computational problem is a NP-hard problem with a number of relevant applications, including the formation of groups of students that have encountered each other least or least recently. Essentially, the aim is to return a membership of nodes in cliques that minimises the sum of their previous (weighted) ties:

∑g=1m∑i=1n−1∑j=i+1nxijyigyjg\sum_{g=1}^{m} \sum_{i=1}^{n-1} \sum_{j=i+1}^{n} x_{ij} y_{ig} y_{jg}

where yig=1y_{ig} = 1 if node ii is in group gg, and 0 otherwise.

xijx_{ij} is the existing network data. If this is an empty network, the function will just return cliques.

A form of the Lai and Hao (2016) iterated maxima search (IMS) is used here. This performs well for small and moderately sized networks. It includes both weak and strong perturbations to an initial solution to ensure that a robust solution from the broader state space is identified. The user is referred to Lai and Hao (2016) and Lai et al (2021) for more details.

Repeated rounds

The history of earlier rounds is held in the network data. A weighted network costs each pair by the weight of their tie. A longitudinal network, with a wave for each earlier round, or a dynamic network, with a time (or begin and end) for each tie, costs each tie by decay for each wave or unit of time before the latest. With decay = 1, every earlier meeting costs the same; with decay = 0, only the latest meetings cost anything. A date is discounted for each day.

To record a new round, add the membership's ties to the network as a new wave, as in the examples.

Mixing on an attribute

Where an attribute is given, the function also places nodes that differ on that attribute in the same group, as in the diversity-based assignment of the grouper package. Both costs are first scaled to [0,1][0,1]. A categorical attribute costs a pair 1 where their categories differ, and a numeric attribute costs a pair their absolute difference over its maximum. balance then weighs the attribute against the ties: 0 considers only the ties, and 1 only the attribute.

References

On the maximally diverse grouping problem

Lai, Xiangjing, and Jin-Kao Hao. 2016. “Iterated Maxima Search for the Maximally Diverse Grouping Problem.” European Journal of Operational Research 254(3):780–800. doi:10.1016/j.ejor.2016.05.018.

Lai, Xiangjing, Jin-Kao Hao, Zhang-Hua Fu, and Dong Yue. 2021. “Neighborhood Decomposition Based Variable Neighborhood Search and Tabu Search for Maximally Diverse Grouping.” European Journal of Operational Research 289(3):1067–86. doi:10.1016/j.ejor.2020.07.048.

See Also

Other memberships: member_brokerage, member_community, member_community_hier, member_community_link, member_community_modular, member_community_partition, member_community_spread, member_components, member_core, member_diffusion, member_equivalence

Other nodal: mark_core, mark_degree, mark_diff, mark_nodes, mark_select_node, measure_accuracy_node, measure_assort_node, measure_broker_node, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_closure_node, measure_core, measure_diffusion_node, measure_diverse_node, member_brokerage, member_community, member_community_hier, member_community_modular, member_community_partition, member_community_spread, member_components, member_core, member_diffusion, member_equivalence, motif_accuracy_node, motif_brokerage_node, motif_clique, motif_composition, motif_exposure, motif_node, motif_path

Examples

node_in_roulette(ison_adolescents, groups = 3)
# Mix the groups on an attribute
marvel_friends <- to_unsigned(to_uniplex(fict_marvel, "relationship"), "positive")
node_in_roulette(marvel_friends, groups = 3, attribute = "Gender")
# Record three rounds as waves, discounting older meetings by half
net <- create_empty(8)
for(round in 1:3){
  grp <- node_in_roulette(net, group_size = 4, decay = 0.5)
  pairs <- which(outer(grp, grp, "==") & upper.tri(diag(8)), arr.ind = TRUE)
  net <- add_ties(net, pairs, attr_list = list(time = rep(round, nrow(pairs))))
}
net

Memberships in communities

Description

node_in_community() returns a single community partition of a network, drawing on all the community detection algorithms available for that type of network.

By default it selects a partition. Where feasible (a small enough network), the optimal problem solving technique is used to ensure the maximal modularity partition. For larger networks, it identifies the applicable algorithms, runs each of them, and returns the partition with the largest modularity score.

Where consensus = TRUE it combines the partitions instead. Each applicable algorithm is run, the stochastic ones repeatedly, and the algorithms are then rerun on how often each pair of nodes is placed together until they agree. This costs considerably more time than selection, but does not rest the answer on a single run of a single algorithm.

Usage

node_in_community(
  .data,
  k = NULL,
  max_k = 8L,
  consensus = FALSE,
  times = 20,
  Kmax = NULL
)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

k

Integer indicating the target number of communities to return. By default NULL, in which case the algorithm returns the number of communities that it finds itself. Alternatively, a character string naming a selection method: "silhouette" selects the number that maximises the mean silhouette width over geodesic distances, "elbow" selects the number at the elbow of the coverage curve, and "strict" returns the partition in which no tie crosses a group, i.e. the components. Prefer "silhouette"; the elbow method is unreliable where the coverage curve has no clear elbow. If the algorithm cannot return exactly the number of communities requested, a warning is given and the nearest number is returned.

max_k

Integer indicating the maximum number of communities to evaluate for "silhouette" and "elbow". By default 8. Otherwise ignored. Note that for node_in_louvain() and node_in_leiden() each candidate requires its own search over the resolution parameter, so a large max_k is costly on large networks.

consensus

Logical, whether to combine the partitions of all the applicable algorithms instead of selecting the one with the highest modularity. By default FALSE, since combining them costs more time. This argument is ignored on a network small enough for node_in_optimal(), which already returns the maximum modularity partition.

times

Integer scalar, how many times the algorithm repeats its work. Where the algorithm is stochastic, this is how many times it runs, and the best or the most frequent result is kept. Where the algorithm searches, this is how many steps the search takes. More repetitions give a more reliable result and take longer, so each function documents its own default.

Kmax

Deprecated. The former spelling of max_k. Still accepted, but warns; please use max_k instead.

Details

times applies only when consensus = TRUE, and is 20 by default. Deterministic algorithms are run once however it is set.

Value

A node_member character vector the length of the nodes in the network, of group memberships "A", "B", etc for each node. If the network is labelled, then the assignments will be labelled with the nodes' names.

Choosing an algorithm

The community detection algorithms are documented on four pages, by the idea that they share:

They differ in whether the number of communities can be set with k, and in whether a second run returns the same partition:

Algorithm Page k Repeatable
node_in_optimal() modular found yes
node_in_louvain() modular optional set a seed
node_in_leiden() modular optional set a seed
node_in_spinglass() modular found set a seed
node_in_infomap() spread found set a seed
node_in_fluid() spread optional set a seed
node_in_labels() spread optional set a seed
node_in_partition() partition optional, 2 by default yes, by default
node_in_faction() partition required, 2 by default set a seed
node_in_betweenness() hierarchical optional yes
node_in_greedy() hierarchical optional yes
node_in_eigen() hierarchical optional yes
node_in_walktrap() hierarchical optional yes

The pages overlap in places: node_in_greedy() and node_in_eigen() also optimise modularity, and node_in_walktrap() also follows random walks. They are documented as hierarchical because the dendrogram, and where it is cut, is what you control.

For signed networks, node_in_community() considers only the three algorithms that read a negative tie as a push apart: node_in_spinglass() (Traag and Bruggeman 2009), node_in_leiden(), and node_in_partition(). The others set the negative ties aside. It selects among these three by net_by_modularity(), which on a signed network counts a negative tie inside a group against the partition (Gómez, Jensen, and Arenas 2009). Spinglass needs a connected network and accepts no k, and Kernighan-Lin is considered only where k is given.

References

On consensus community detection

Lancichinetti, Andrea, and Santo Fortunato. 2012. "Consensus clustering in complex networks". Scientific Reports 2: 336. doi:10.1038/srep00336

Tagarelli, Andrea, Alessia Amelio, and Francesco Gullo. 2017. "Ensemble-based Community Detection in Multilayer Networks". Data Mining and Knowledge Discovery 31: 1506-1543. doi:10.1007/s10618-017-0528-8

On signed modularity

Gómez, Sergio, Pablo Jensen, and Alex Arenas. 2009. "Analysis of community structure in networks of correlated data". Physical Review E 80: 016114. doi:10.1103/PhysRevE.80.016114

Traag, Vincent A., and Jeroen Bruggeman. 2009. "Community detection in networks with positive and negative links". Physical Review E 80: 036115. doi:10.1103/PhysRevE.80.036115

See Also

Other community: member_community_hier, member_community_link, member_community_modular, member_community_partition, member_community_spread

Other memberships: member_brokerage, member_cliques, member_community_hier, member_community_link, member_community_modular, member_community_partition, member_community_spread, member_components, member_core, member_diffusion, member_equivalence

Other nodal: mark_core, mark_degree, mark_diff, mark_nodes, mark_select_node, measure_accuracy_node, measure_assort_node, measure_broker_node, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_closure_node, measure_core, measure_diffusion_node, measure_diverse_node, member_brokerage, member_cliques, member_community_hier, member_community_modular, member_community_partition, member_community_spread, member_components, member_core, member_diffusion, member_equivalence, motif_accuracy_node, motif_brokerage_node, motif_clique, motif_composition, motif_exposure, motif_node, motif_path

Examples

node_in_community(ison_adolescents)

Memberships in communities that form a hierarchy

Description

These functions offer algorithms for hierarchically clustering networks into communities. Since all of the following are hierarchical, their dendrograms can be plotted:

  • node_in_betweenness() is a hierarchical, decomposition algorithm where edges are removed in decreasing order of the number of shortest paths passing through the edge.

  • node_in_greedy() is a hierarchical, agglomerative algorithm, that tries to optimize modularity in a greedy manner.

  • node_in_eigen() is a top-down, hierarchical algorithm.

  • node_in_walktrap() is a hierarchical, agglomerative algorithm based on random walks.

The different algorithms offer various advantages in terms of computation time, availability on different types of networks, ability to maximise modularity, and their logic or domain of inspiration. See member_community for a comparison with the other community detection algorithms.

Usage

node_in_betweenness(.data, k = NULL, max_k = 8L, Kmax = NULL)

node_in_greedy(.data, k = NULL, max_k = 8L, Kmax = NULL)

node_in_eigen(.data, k = NULL, max_k = 8L, Kmax = NULL)

node_in_walktrap(.data, k = NULL, max_k = 8L, steps = 4, Kmax = NULL)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

k

Integer indicating the target number of communities to return. By default NULL, in which case the algorithm returns the number of communities that it finds itself. Alternatively, a character string naming a selection method: "silhouette" selects the number that maximises the mean silhouette width over geodesic distances, "elbow" selects the number at the elbow of the coverage curve, and "strict" returns the partition in which no tie crosses a group, i.e. the components. Prefer "silhouette"; the elbow method is unreliable where the coverage curve has no clear elbow. If the algorithm cannot return exactly the number of communities requested, a warning is given and the nearest number is returned.

max_k

Integer indicating the maximum number of communities to evaluate for "silhouette" and "elbow". By default 8. Otherwise ignored. Note that for node_in_louvain() and node_in_leiden() each candidate requires its own search over the resolution parameter, so a large max_k is costly on large networks.

Kmax

Deprecated. The former spelling of max_k. Still accepted, but warns; please use max_k instead.

steps

Integer indicating the length of the random walks. By default steps = 4, as in {igraph}. Longer walks reach further and tend to return fewer, larger communities.

Details

For signed networks, these algorithms consider only the positive ties, and say so. They read a tie's weight as the strength of a pull into the same community, and a negative tie is hostility rather than such a pull. Only node_in_spinglass() reads a sign as a sign. Use manynet::to_unsigned() first to control this yourself.

Value

A node_member character vector the length of the nodes in the network, of group memberships "A", "B", etc for each node. If the network is labelled, then the assignments will be labelled with the nodes' names.

Edge-betweenness

This is motivated by the idea that edges connecting different groups are more likely to lie on multiple shortest paths when they are the only option to go from one group to another. This method yields good results but is very slow because of the computational complexity of edge-betweenness calculations and the betweenness scores have to be re-calculated after every edge removal. Networks of ~700 nodes and ~3500 ties are around the upper size limit that are feasible with this approach.

Fast-greedy

Initially, each node is assigned a separate community. Communities are then merged iteratively such that each merge yields the largest increase in the current value of modularity, until no further increases to the modularity are possible. The method is fast and recommended as a first approximation because it has no parameters to tune. However, it is known to suffer from a resolution limit.

Leading eigenvector

In each step, the network is bifurcated such that modularity increases most. The splits are determined according to the leading eigenvector of the modularity matrix. A stopping condition prevents tightly connected groups from being split further. Note that due to the eigenvector calculations involved, this algorithm will perform poorly on degenerate networks, but will likely obtain a higher modularity than fast-greedy (at some cost of speed).

Walktrap

The general idea is that random walks on a network are more likely to stay within the same community because few edges lead outside a community. By repeating random walks of 4 steps many times, information about the hierarchical merging of communities is collected.

References

On edge-betweenness community detection

Newman, Mark, and Michelle Girvan. 2004. "Finding and evaluating community structure in networks." Physical Review E 69: 026113. doi:10.1103/PhysRevE.69.026113

On fast-greedy community detection

Clauset, Aaron, Mark E.J. Newman, and Cristopher Moore. 2004. "Finding community structure in very large networks." Physical Review E, 70: 066111. doi:10.1103/PhysRevE.70.066111

On leading eigenvector community detection

Newman, Mark E.J. 2006. "Finding community structure using the eigenvectors of matrices" Physical Review E 74:036104. doi:10.1103/PhysRevE.74.036104

On walktrap community detection

Pons, Pascal, and Matthieu Latapy. 2005. "Computing communities in large networks using random walks". 1-20. doi:10.48550/arXiv.physics/0512106

See Also

Other memberships: member_brokerage, member_cliques, member_community, member_community_link, member_community_modular, member_community_partition, member_community_spread, member_components, member_core, member_diffusion, member_equivalence

Other nodal: mark_core, mark_degree, mark_diff, mark_nodes, mark_select_node, measure_accuracy_node, measure_assort_node, measure_broker_node, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_closure_node, measure_core, measure_diffusion_node, measure_diverse_node, member_brokerage, member_cliques, member_community, member_community_modular, member_community_partition, member_community_spread, member_components, member_core, member_diffusion, member_equivalence, motif_accuracy_node, motif_brokerage_node, motif_clique, motif_composition, motif_exposure, motif_node, motif_path

Other community: member_community, member_community_link, member_community_modular, member_community_partition, member_community_spread

Examples

node_in_betweenness(ison_adolescents)
node_in_greedy(ison_adolescents)
node_in_eigen(ison_adolescents)
node_in_walktrap(ison_adolescents)

Memberships in communities that optimise a quality function

Description

These functions score a partition with a quality function, such as modularity, and search for the partition that scores best:

  • node_in_optimal() is a problem-solving algorithm that seeks to maximise modularity over all possible partitions.

  • node_in_spinglass() is a greedy, iterative, probabilistic algorithm, based on analogy to model from statistical physics.

  • node_in_louvain() is an agglomerative multilevel algorithm that seeks to maximise modularity over all possible partitions.

  • node_in_leiden() is an agglomerative multilevel algorithm that seeks to maximise the Constant Potts Model over all possible partitions.

They differ in the quality function, in how thoroughly they search, and so in how large a network they can be used on. See member_community for a comparison with the other community detection algorithms.

Usage

node_in_optimal(.data)

node_in_spinglass(.data, max_k = 200, resolution = 1)

node_in_louvain(.data, k = NULL, max_k = 8L, resolution = 1, Kmax = NULL)

node_in_leiden(.data, k = NULL, max_k = 8L, resolution = NULL, Kmax = NULL)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

max_k

Integer indicating the maximum number of communities to evaluate for "silhouette" and "elbow". By default 8. Otherwise ignored. Note that for node_in_louvain() and node_in_leiden() each candidate requires its own search over the resolution parameter, so a large max_k is costly on large networks.

resolution

The Reichardt-Bornholdt “gamma” resolution parameter for modularity. By default 1, making existing and non-existing ties equally important. Smaller values make existing ties more important, and larger values make missing ties more important. node_in_leiden() takes NULL by default, and then uses the density of the network, since the Constant Potts Model gives every node its own community at any higher resolution.

k

Integer indicating the target number of communities to return. By default NULL, in which case the algorithm returns the number of communities that it finds itself. Alternatively, a character string naming a selection method: "silhouette" selects the number that maximises the mean silhouette width over geodesic distances, "elbow" selects the number at the elbow of the coverage curve, and "strict" returns the partition in which no tie crosses a group, i.e. the components. Prefer "silhouette"; the elbow method is unreliable where the coverage curve has no clear elbow. If the algorithm cannot return exactly the number of communities requested, a warning is given and the nearest number is returned.

Kmax

Deprecated. The former spelling of max_k. Still accepted, but warns; please use max_k instead.

Details

For signed networks, node_in_optimal() and node_in_louvain() consider only the positive ties, and say so. They read a tie's weight as the strength of a pull into the same community, and a negative tie is hostility rather than such a pull. node_in_spinglass() and node_in_leiden() read a sign as a sign: a negative tie inside a community counts against it. Use manynet::to_unsigned() first to control this yourself.

Value

A node_member character vector the length of the nodes in the network, of group memberships "A", "B", etc for each node. If the network is labelled, then the assignments will be labelled with the nodes' names.

Optimal

The general idea is to calculate the modularity of all possible partitions, and choose the community structure that maximises this modularity measure. Note that this is an NP-complete problem with exponential time complexity. The guidance in the igraph package is networks of <50-200 nodes is probably fine.

Spin-glass

Here max_k is the number of spins, an upper limit on the communities found rather than a bound on a search, so some can end up empty.

This is motivated by analogy to the Potts model in statistical physics. Each node can be in one of k "spin states", and ties (particle interactions) provide information about which pairs of nodes want similar or different spin states. The final community definitions are represented by the nodes' spin states after a number of updates. A different implementation than the default is used in the case of signed networks, such that nodes connected by negative ties will be more likely found in separate communities.

Louvain

The general idea is to take a hierarchical approach to optimising the modularity criterion. Nodes begin in their own communities and are re-assigned in a local, greedy way: each node is moved to the community where it achieves the highest contribution to modularity. When no further modularity-increasing reassignments are possible, the resulting communities are considered nodes (like a reduced graph), and the process continues. Where k is given, the resolution parameter is searched for the value that returns that number of communities, and resolution is ignored.

Leiden

The general idea is to optimise the Constant Potts Model, which does not suffer from the resolution limit, instead of modularity. As outlined in the {igraph} package, the Constant Potts Model object function is:

12m∑ij(Aij−γninj)δ(σi,σj)\frac{1}{2m} \sum_{ij}(A_{ij}-\gamma n_i n_j)\delta(\sigma_i, \sigma_j)

where m is the total tie weight, AijA_{ij} is the tie weight between i and j, γ\gamma is the so-called resolution parameter, nin_i is the node weight of node i, and δ(σi,σj)=1\delta(\sigma_i, \sigma_j) = 1 if and only if i and j are in the same communities and 0 otherwise. Compared to the Louvain method, the Leiden algorithm additionally tries to avoid unconnected communities. The resolution is the density of the network by default, after Traag et al., since the Constant Potts Model gives every node its own community at any higher resolution. This holds for an unweighted network too, where each tie weighs 1. Where k is given, the resolution parameter is searched for the value that returns that number of communities, and resolution is ignored.

References

On optimal community detection

Brandes, Ulrik, Daniel Delling, Marco Gaertler, Robert Gorke, Martin Hoefer, Zoran Nikoloski, Dorothea Wagner. 2008. "On Modularity Clustering", IEEE Transactions on Knowledge and Data Engineering 20(2):172-188.

On spinglass community detection

Reichardt, Jorg, and Stefan Bornholdt. 2006. "Statistical Mechanics of Community Detection" Physical Review E, 74(1): 016110–14. doi:10.1073/pnas.0605965104

Traag, Vincent A., and Jeroen Bruggeman. 2009. "Community detection in networks with positive and negative links". Physical Review E, 80(3): 036115. doi:10.1103/PhysRevE.80.036115

On Louvain community detection

Blondel, Vincent, Jean-Loup Guillaume, Renaud Lambiotte, Etienne Lefebvre. 2008. "Fast unfolding of communities in large networks", J. Stat. Mech. P10008.

On Leiden community detection

Traag, Vincent A., Ludo Waltman, and Nees Jan van Eck. 2019. "From Louvain to Leiden: guaranteeing well-connected communities", Scientific Reports, 9(1):5233. doi:10.1038/s41598-019-41695-z

See Also

Other community: member_community, member_community_hier, member_community_link, member_community_partition, member_community_spread

Other memberships: member_brokerage, member_cliques, member_community, member_community_hier, member_community_link, member_community_partition, member_community_spread, member_components, member_core, member_diffusion, member_equivalence

Other nodal: mark_core, mark_degree, mark_diff, mark_nodes, mark_select_node, measure_accuracy_node, measure_assort_node, measure_broker_node, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_closure_node, measure_core, measure_diffusion_node, measure_diverse_node, member_brokerage, member_cliques, member_community, member_community_hier, member_community_partition, member_community_spread, member_components, member_core, member_diffusion, member_equivalence, motif_accuracy_node, motif_brokerage_node, motif_clique, motif_composition, motif_exposure, motif_node, motif_path

Examples

node_in_optimal(ison_adolescents)
node_in_spinglass(ison_adolescents)
node_in_louvain(ison_adolescents)
node_in_leiden(ison_adolescents)

Memberships in communities that fill a set number of groups

Description

These functions divide the nodes into a number of groups that you set, two by default:

  • node_in_partition() is a greedy, iterative, deterministic partitioning algorithm that results in two equally-sized communities.

  • node_in_faction() is a tabu search for the k groups, of any size, that come closest to being separate cliques.

Since they return the number of groups asked for whether or not the network holds that many communities, check the fit of the result, e.g. with net_by_modularity(). See member_community for a comparison with the other community detection algorithms.

Usage

node_in_partition(
  .data,
  k = 2L,
  max_k = 8L,
  start = c("order", "random"),
  Kmax = NULL
)

node_in_faction(
  .data,
  k = 2L,
  variant = c("hamming", "phi", "modularity"),
  times = NULL
)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

k

Integer indicating the target number of communities to return. By default NULL, in which case the algorithm returns the number of communities that it finds itself. Alternatively, a character string naming a selection method: "silhouette" selects the number that maximises the mean silhouette width over geodesic distances, "elbow" selects the number at the elbow of the coverage curve, and "strict" returns the partition in which no tie crosses a group, i.e. the components. Prefer "silhouette"; the elbow method is unreliable where the coverage curve has no clear elbow. If the algorithm cannot return exactly the number of communities requested, a warning is given and the nearest number is returned.

max_k

Integer indicating the maximum number of communities to evaluate for "silhouette" and "elbow". By default 8. Otherwise ignored. Note that for node_in_louvain() and node_in_leiden() each candidate requires its own search over the resolution parameter, so a large max_k is costly on large networks.

start

One of "order" (the default) or "random", naming how the nodes are dealt into the groups to begin with. "order" deals them in node order, which makes the algorithm deterministic. "random" deals them at random, as Kernighan and Lin do. Since the algorithm is sensitive to where it starts, a random start can reach a different partition; set a seed to repeat one.

Kmax

Deprecated. The former spelling of max_k. Still accepted, but warns; please use max_k instead.

variant

Which measure of fit the factions should optimise. One of "hamming" (the default), "phi", or "modularity".

times

Integer scalar, how many times the algorithm repeats its work. Where the algorithm is stochastic, this is how many times it runs, and the best or the most frequent result is kept. Where the algorithm searches, this is how many steps the search takes. More repetitions give a more reliable result and take longer, so each function documents its own default.

Value

A node_member character vector the length of the nodes in the network, of group memberships "A", "B", etc for each node. If the network is labelled, then the assignments will be labelled with the nodes' names.

Partition

The general idea is to assign nodes to two groups, and then iteratively swap pairs of nodes (one from each group) that give a positive sum of net tie costs, where the net tie cost of a node is the difference between the sum of the weights of ties to nodes in the other group (external costs) and the sum of the weights of ties to nodes in the same group (internal costs). A pass exchanges the candidate pairs one at a time and keeps the prefix that leaves the most weight inside the two groups, so a pass never returns a worse split than it started from. Where k is greater than two, the same swap pass is run for every pair of groups, and the rounds repeat until no pass improves the partition. Where start = "order", the default, the nodes are dealt into the groups in node order, and the algorithm is deterministic: one network returns one partition. Where start = "random" they are dealt at random, which is the textbook start, and repeated calls can then return different partitions. The result is not guaranteed to maximise modularity either way, since the algorithm reads the weight of the ties inside the groups and not the modularity, and since it holds the groups at equal size. Note that this algorithm is only applicable to undirected, unipartite networks, and returns k communities of equal size (or as close to equal as possible). For k groups that are free to take any size, see node_in_faction().

For signed networks, node_in_partition() reads a sign as a sign: a negative tie inside a group lowers the weight that the swaps maximise, so negative ties are moved between groups. Use manynet::to_unsigned() first to consider one sign alone.

Faction

The general idea is that a network of factions is one of separate cliques: every pair of nodes in the same group is tied, and no pair in different groups is. node_in_faction() searches for the partition into k groups that comes closest to that ideal, using a tabu search; see search_tabu() for how it works. Unlike node_in_partition(), the groups are free to take any size, and unlike node_in_optimal(), the number of groups is yours to choose.

variant names how closeness to the ideal is scored:

  • "hamming" (the default) counts the errors: the pairs within a group that are not tied plus the pairs in different groups that are.

  • "phi" is the correlation between the network and the ideal, with ones for pairs in the same group and zeros for pairs in different groups.

  • "modularity" is the share of ties that fall within groups less the share expected if ties fell at random among nodes of the same degrees.

"hamming" and "phi" read the pattern of ties and not their weights, and "modularity" reads a directed network as undirected.

Some care is needed in reading the result. The search always returns k groups, however poor the best fit is, so the groups it returns need not be cohesive: check the fit with net_by_modularity() or net_by_inconsistency(). The search may also end in a local minimum, and it returns one partition even where several fit equally well. Since it begins from random partitions, repeated calls can return different partitions; where they agree, the split is a clear one. Set a seed to repeat a result.

Note that k must be an integer here, since the search needs to know how many groups to fill, and that times is by default the number of nodes multiplied by k.

For signed networks, node_in_faction() reads a sign as a sign, and the ideal is structural balance: positive ties within the factions and negative ties between them. "hamming" then counts the errors as Doreian and Mrvar (1996) do, the negative ties within factions plus the positive ties between them, and an absent tie is no error either way. "phi" correlates the sign of each pair's tie with whether the pair shares a faction, and "modularity" maximises signed modularity (see net_by_modularity()). Use manynet::to_unsigned() first to consider one sign alone.

References

On partitioning signed networks

Doreian, Patrick, and Andrej Mrvar. 1996. "A partitioning approach to structural balance". Social Networks 18(2): 149-168. doi:10.1016/0378-8733(95)00259-6

On partitioning community detection

Kernighan, Brian W., and Shen Lin. 1970. "An efficient heuristic procedure for partitioning graphs." The Bell System Technical Journal 49(2): 291-307. doi:10.1002/j.1538-7305.1970.tb01770.x

On faction community detection

de Amorim, Samuel G., Jean-Pierre Barthélemy, and Celso C. Ribeiro. 1992. "Clustering and clique partitioning: Simulated annealing and tabu search approaches." Journal of Classification 9(1): 17-41. doi:10.1007/BF02618466

Borgatti, Stephen P., Martin G. Everett, and Linton C. Freeman. 2002. UCINET for Windows: Software for Social Network Analysis. Harvard, MA: Analytic Technologies.

See Also

Other community: member_community, member_community_hier, member_community_link, member_community_modular, member_community_spread

Other memberships: member_brokerage, member_cliques, member_community, member_community_hier, member_community_link, member_community_modular, member_community_spread, member_components, member_core, member_diffusion, member_equivalence

Other nodal: mark_core, mark_degree, mark_diff, mark_nodes, mark_select_node, measure_accuracy_node, measure_assort_node, measure_broker_node, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_closure_node, measure_core, measure_diffusion_node, measure_diverse_node, member_brokerage, member_cliques, member_community, member_community_hier, member_community_modular, member_community_spread, member_components, member_core, member_diffusion, member_equivalence, motif_accuracy_node, motif_brokerage_node, motif_clique, motif_composition, motif_exposure, motif_node, motif_path

Examples

node_in_partition(ison_adolescents)
node_in_partition(ison_southern_women)
node_in_faction(ison_adolescents)
node_in_faction(ison_adolescents, k = 3, variant = "modularity")

Memberships in communities that follow a spreading process

Description

These functions follow a process as it spreads over the network, and read the communities off where it settles:

  • node_in_infomap() is an algorithm based on the information in random walks.

  • node_in_fluid() is a propogation-based partitioning algorithm, based on analogy to model from fluid dynamics.

  • node_in_labels() is a fast, propagation-based algorithm in which nodes iteratively adopt whichever community label is most common among their neighbours.

They need no quality function, and are among the fastest algorithms, but each run can return a different partition. See member_community for a comparison with the other community detection algorithms.

Usage

node_in_infomap(.data, times = 50)

node_in_fluid(.data, k = NULL, max_k = 8L, Kmax = NULL)

node_in_labels(.data, k = NULL, max_k = 8L, Kmax = NULL)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

times

Integer scalar, how many times the algorithm repeats its work. Where the algorithm is stochastic, this is how many times it runs, and the best or the most frequent result is kept. Where the algorithm searches, this is how many steps the search takes. More repetitions give a more reliable result and take longer, so each function documents its own default.

k

Integer indicating the target number of communities to return. By default NULL, in which case the algorithm returns the number of communities that it finds itself. Alternatively, a character string naming a selection method: "silhouette" selects the number that maximises the mean silhouette width over geodesic distances, "elbow" selects the number at the elbow of the coverage curve, and "strict" returns the partition in which no tie crosses a group, i.e. the components. Prefer "silhouette"; the elbow method is unreliable where the coverage curve has no clear elbow. If the algorithm cannot return exactly the number of communities requested, a warning is given and the nearest number is returned.

max_k

Integer indicating the maximum number of communities to evaluate for "silhouette" and "elbow". By default 8. Otherwise ignored. Note that for node_in_louvain() and node_in_leiden() each candidate requires its own search over the resolution parameter, so a large max_k is costly on large networks.

Kmax

Deprecated. The former spelling of max_k. Still accepted, but warns; please use max_k instead.

Details

For signed networks, these algorithms consider only the positive ties, and say so. They read a tie's weight as the strength of a pull into the same community, and a negative tie is hostility rather than such a pull. Only node_in_spinglass() reads a sign as a sign. Use manynet::to_unsigned() first to control this yourself.

Value

A node_member character vector the length of the nodes in the network, of group memberships "A", "B", etc for each node. If the network is labelled, then the assignments will be labelled with the nodes' names.

Infomap

Motivated by information theoretic principles, this algorithm tries to build a grouping that provides the shortest description length for a random walk, where the description length is measured by the expected number of bits per node required to encode the path.

Fluid

The general idea is to observe how a discrete number of fluids interact, expand and contract, in a non-homogenous environment, i.e. the network structure. Unlike the {igraph} implementation that this function wraps, this function iterates over all possible numbers of communities and returns the membership associated with the highest modularity.

Label propagation

Every node is initially given a unique label. Nodes are then visited in random order, each adopting whichever label is most frequent among its neighbours, until no node has a label that a majority of its neighbours does not share. Densely connected groups quickly converge on a common label, which is what makes the communities.

This is the fastest of the algorithms here, running in near-linear time, which makes it useful on large networks where the others are infeasible. The trade-off is that it is stochastic: because both the visiting order and ties between equally frequent labels are broken at random, repeated runs on the same network can return different partitions, and on sparse networks it may return a single community. Set a seed for reproducibility, or use node_in_community() to select among algorithms by modularity.

Where k is given, the algorithm becomes semi-supervised. The k nodes of highest degree are each given a distinct, fixed label, every other node starts with a label of its own, and propagation runs as normal. Seeding alone tends to leave more than k labels standing, so any surplus groups are then merged in the order that best preserves modularity, until exactly k communities remain.

References

On infomap community detection

Rosvall, M, and C. T. Bergstrom. 2008. "Maps of information flow reveal community structure in complex networks", PNAS 105:1118. doi:10.1073/pnas.0706851105

Rosvall, M., D. Axelsson, and C. T. Bergstrom. 2009. "The map equation", Eur. Phys. J. Special Topics 178: 13. doi:10.1140/epjst/e2010-01179-1

On fluid community detection

Parés Ferran, Dario Garcia Gasulla, Armand Vilalta, Jonatan Moreno, Eduard Ayguade, Jesus Labarta, Ulises Cortes, and Toyotaro Suzumura. 2018. "Fluid Communities: A Competitive, Scalable and Diverse Community Detection Algorithm". In: Complex Networks & Their Applications VI Springer, 689: 229. doi:10.1007/978-3-319-72150-7_19

On label propagation community detection

Raghavan, Usha Nandini, Reka Albert, and Soundar Kumara. 2007. "Near linear time algorithm to detect community structures in large-scale networks", Physical Review E, 76(3):036106. doi:10.1103/PhysRevE.76.036106

See Also

Other community: member_community, member_community_hier, member_community_link, member_community_modular, member_community_partition

Other memberships: member_brokerage, member_cliques, member_community, member_community_hier, member_community_link, member_community_modular, member_community_partition, member_components, member_core, member_diffusion, member_equivalence

Other nodal: mark_core, mark_degree, mark_diff, mark_nodes, mark_select_node, measure_accuracy_node, measure_assort_node, measure_broker_node, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_closure_node, measure_core, measure_diffusion_node, measure_diverse_node, member_brokerage, member_cliques, member_community, member_community_hier, member_community_modular, member_community_partition, member_components, member_core, member_diffusion, member_equivalence, motif_accuracy_node, motif_brokerage_node, motif_clique, motif_composition, motif_exposure, motif_node, motif_path

Examples

node_in_infomap(ison_adolescents)
node_in_fluid(ison_adolescents)
node_in_labels(ison_adolescents)

Memberships in components

Description

These functions create a vector of nodes' memberships in components:

  • node_in_component() assigns nodes' component membership, in either the strongly or the weakly connected components.

In graph theory, components, sometimes called connected components, are induced subgraphs from partitioning the nodes into disjoint sets. All nodes that are members of the same partition as i are reachable from i.

For directed networks, strongly connected components consist of subgraphs where there are paths in each direction between member nodes. Weakly connected components consist of subgraphs where there is a path in either direction between member nodes.

Usage

node_in_component(.data, connectivity = c("strong", "weak"))

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

connectivity

Character string, "weak" treats a directed network's components as if the network were undirected, and "strong" requires ties in both directions between members. This is ignored for undirected networks, where the two notions coincide. Note that the default differs by function: functions that assert or count connectedness default to "strong", while functions that scope or split a network into components default to "weak".

Value

A node_member character vector the length of the nodes in the network, of group memberships "A", "B", etc for each node. If the network is labelled, then the assignments will be labelled with the nodes' names.

See Also

Other memberships: member_brokerage, member_cliques, member_community, member_community_hier, member_community_link, member_community_modular, member_community_partition, member_community_spread, member_core, member_diffusion, member_equivalence

Other nodal: mark_core, mark_degree, mark_diff, mark_nodes, mark_select_node, measure_accuracy_node, measure_assort_node, measure_broker_node, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_closure_node, measure_core, measure_diffusion_node, measure_diverse_node, member_brokerage, member_cliques, member_community, member_community_hier, member_community_modular, member_community_partition, member_community_spread, member_core, member_diffusion, member_equivalence, motif_accuracy_node, motif_brokerage_node, motif_clique, motif_composition, motif_exposure, motif_node, motif_path

Examples

ison_monks |> to_uniplex("esteem") |>
  mutate_nodes(comp = node_in_component())
ison_monks |> to_uniplex("esteem") |>
  mutate_nodes(comp = node_in_component(connectivity = "weak"))

Memberships in core-periphery categories

Description

node_in_core() categorizes nodes into two or more core/periphery categories based on their coreness.

Usage

node_in_core(
  .data,
  groups = 3,
  split = c("bins", "quantiles", "kmeans"),
  coreness = NULL,
  direction = c("all", "out", "in", "both"),
  cluster_by = NULL
)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

groups

Number of categories to create. Must be at least 2 and at most the number of nodes in the network. Default is 3.

split

Which method to use to split the coreness scores into the categories. One of "bins" (equal-width bins), "quantiles" (quantile-based bins), or "kmeans" (k-means clustering); see method_split for what each does. Default is "bins".

coreness

Which method to use to calculate nodes' coreness. One of "correlation", "rich", "transition", or "hub"; see method_coreness for what each does. By default NULL, which uses "rich" for a weighted, directed, or two-mode network, since it is the only method that reads those properties directly, and "correlation" otherwise.

direction

One of "all" (the default), "out", "in", or "both". For a directed network, "out" scores nodes on the ties they send and "in" on the ties they receive, while "both" returns the four categories described below. Ignored for undirected and two-mode networks.

cluster_by

Deprecated. The former spelling of split. Still accepted, but warns; please use split instead.

Value

A node_member character vector the length of the nodes in the network, of group memberships "A", "B", etc for each node. If the network is labelled, then the assignments will be labelled with the nodes' names.

Core-periphery categories

This function categorizes nodes based on their coreness into a specified number of groups. The groups are labeled as "Core", "Semi-core", "Semi-periphery", and "Periphery" depending on the number of groups specified. The categorization can be done using different methods: equal-width bins, quantile-based bins, or k-means clustering.

Directed core-periphery

In a directed network a node can be core in whom it reaches and peripheral in who reaches it, which one core and one periphery cannot express. direction = "both" therefore returns the four categories that Elliott and colleagues distinguish:

  • "Core" for nodes in both the out-core and the in-core,

  • "Sender" for nodes in the out-core only,

  • "Receiver" for nodes in the in-core only,

  • "Periphery" for nodes in neither.

This uses coreness_hub(), so groups and split do not apply.

References

On core-periphery categorization

Wallerstein, Immanuel. 1974. "Dependence in an Interdependent World: The Limited Possibilities of Transformation Within the Capitalist World Economy." African Studies Review, 17(1), 1-26. doi:10.2307/523574

On directed core-periphery

Elliott, Andrew, Angus Chiu, Marya Bazzi, Gesine Reinert, and Mihai Cucuringu. 2020. "Core-periphery structure in directed networks". Proceedings of the Royal Society A 476(2241): 20190783. doi:10.1098/rspa.2019.0783

See Also

Other core-periphery: mark_core, measure_core

Other memberships: member_brokerage, member_cliques, member_community, member_community_hier, member_community_link, member_community_modular, member_community_partition, member_community_spread, member_components, member_diffusion, member_equivalence

Other nodal: mark_core, mark_degree, mark_diff, mark_nodes, mark_select_node, measure_accuracy_node, measure_assort_node, measure_broker_node, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_closure_node, measure_core, measure_diffusion_node, measure_diverse_node, member_brokerage, member_cliques, member_community, member_community_hier, member_community_modular, member_community_partition, member_community_spread, member_components, member_diffusion, member_equivalence, motif_accuracy_node, motif_brokerage_node, motif_clique, motif_composition, motif_exposure, motif_node, motif_path

Examples

node_in_core(ison_adolescents)
node_in_core(ison_networkers, direction = "both")

Memberships in a diffusion process

Description

node_in_adopter() classifies membership of nodes into diffusion categories by where on the distribution of adopters they fell. Valente (1995) defines five memberships:

  • Early adopter: those with an adoption time less than the average adoption time minus one standard deviation of adoptions times

  • Early majority: those with an adoption time between the average adoption time and the average adoption time minus one standard deviation of adoptions times

  • Late majority: those with an adoption time between the average adoption time and the average adoption time plus one standard deviation of adoptions times

  • Laggard: those with an adoption time greater than the average adoption time plus one standard deviation of adoptions times

  • Non-adopter: those without an adoption time, i.e. never adopted

Usage

node_in_adopter(.data)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

Value

A node_member character vector the length of the nodes in the network, of group memberships "A", "B", etc for each node. If the network is labelled, then the assignments will be labelled with the nodes' names.

References

On adopter classes

Valente, Tom W. 1995. Network models of the diffusion of innovations (2nd ed.). Cresskill N.J.: Hampton Press.

See Also

Other memberships: member_brokerage, member_cliques, member_community, member_community_hier, member_community_link, member_community_modular, member_community_partition, member_community_spread, member_components, member_core, member_equivalence

Other nodal: mark_core, mark_degree, mark_diff, mark_nodes, mark_select_node, measure_accuracy_node, measure_assort_node, measure_broker_node, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_closure_node, measure_core, measure_diffusion_node, measure_diverse_node, member_brokerage, member_cliques, member_community, member_community_hier, member_community_modular, member_community_partition, member_community_spread, member_components, member_core, member_equivalence, motif_accuracy_node, motif_brokerage_node, motif_clique, motif_composition, motif_exposure, motif_node, motif_path

Other diffusion: mark_diff, measure_diffusion_infection, measure_diffusion_net, measure_diffusion_node, motif_exposure, motif_hazard

Examples

smeg <- generate_smallworld(15, 0.025)
  smeg_diff <- play_diffusion(smeg, recovery = 0.2)
  # To classify nodes by their position in the adoption curve
  (adopts <- node_in_adopter(smeg_diff))
  summary(adopts)

Memberships in equivalent classes

Description

These functions combine an appropriate ⁠node_x_*()⁠ function together with methods for calculating the hierarchical clusters provided by how alike nodes' profiles are.

  • node_in_equivalence() assigns nodes membership based on their equivalence with respective to some motif/class. The following functions call this function, together with an appropriate motif.

  • node_in_structural() assigns nodes membership based on their having equivalent ties to the same other nodes.

  • node_in_regular() assigns nodes membership based on their having equivalent patterns of ties to equivalent others.

  • node_in_automorphic() assigns nodes membership based on their having equivalent distances to other nodes.

  • node_in_motif() assigns nodes membership based on their participating in local structures at similar rates.

A plot() method exists for investigating the dendrogram of the hierarchical cluster and showing the returned cluster assignment.

Usage

node_in_equivalence(
  .data,
  motif,
  k = c("silhouette", "elbow", "strict"),
  cluster = c("hierarchical", "concor"),
  distance = NULL,
  max_k = 8L,
  proximity = "pearson",
  Kmax = NULL
)

node_in_structural(
  .data,
  k = c("silhouette", "elbow", "strict"),
  cluster = c("hierarchical", "concor"),
  distance = NULL,
  max_k = 8L,
  proximity = "pearson",
  Kmax = NULL
)

node_in_regular(
  .data,
  k = c("silhouette", "elbow", "strict"),
  cluster = c("hierarchical", "concor"),
  distance = NULL,
  max_k = 8L,
  regularity = c("rolesim", "rege"),
  decay = 0.15,
  beta = NULL,
  Kmax = NULL
)

node_in_motif(
  .data,
  k = c("silhouette", "elbow", "strict"),
  cluster = c("hierarchical", "concor"),
  distance = NULL,
  max_k = 8L,
  proximity = "pearson",
  Kmax = NULL
)

node_in_automorphic(
  .data,
  k = c("silhouette", "elbow", "strict"),
  cluster = c("hierarchical", "concor"),
  distance = NULL,
  max_k = 8L,
  proximity = "pearson",
  Kmax = NULL
)

node_in_block(
  .data,
  k = 2L,
  blocks = c("nul", "com"),
  times = NULL,
  search = c("tabu", "iterated")
)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

motif

A matrix returned by a ⁠node_x_*()⁠ function.

k

Typically a character string indicating which method should be used to select the number of clusters to return. By default "silhouette", other options include "elbow" and "strict". "strict" returns classes with members only when strictly equivalent. "silhouette" and "elbow" select classes based on the distance between clusters or between nodes within a cluster. Fewer, identifiable letters, e.g. "e" for elbow, is sufficient. Alternatively, if k is passed an integer, e.g. k = 3, then all selection routines are skipped in favour of this number of clusters.

cluster

Character string indicating whether clusters should be clustered hierarchically ("hierarchical") or through convergence of correlations ("concor"). Fewer, identifiable letters, e.g. "c" for CONCOR, is sufficient. "cosine" is deprecated; use proximity = "cosine" instead.

distance

Character string indicating which distance metric to pass on to stats::dist to compare nodes a second time, on their profiles of dissimilarities to all nodes. By default NULL, so that the proximities are clustered directly. Options include "euclidean", "maximum", "manhattan", "canberra", "binary", and "minkowski". Fewer, identifiable letters, e.g. "e" for Euclidean, is sufficient. Before v1.1.0 the default was "euclidean", so pass that to reproduce earlier results. Ignored when cluster = "concor".

max_k

Integer indicating the maximum number of (k) clusters to evaluate. Ignored when k = "strict" or a discrete number is given for k.

proximity

Character string indicating how nodes' profiles should be compared, passed on to manynet::to_proximity(). By default "pearson", their correlation, but any measure offered there can be used, e.g. "cosine", "ruzicka", "overlap", "euclidean", or "hamming". Note that "jaccard" dichotomises a valued census; "ruzicka" is the weighted counterpart that keeps the counts. The proximities themselves are in the proximity element of the clustering, e.g. attr(node_in_structural(.data), "hc")$proximity, or can be made with manynet::to_proximity() from any census, using across = "rows" and dyad = "include". Ignored when cluster = "concor". "asis" clusters a motif that is already a node-by-node similarity. node_in_regular() does not take it, since ⁠regularity_*()⁠ already returns a node-by-node similarity, which is clustered as it is.

Kmax

Deprecated. The former spelling of max_k. Still accepted, but warns; please use max_k instead.

regularity

Character string indicating which algorithm should be used to calculate how regularly equivalent nodes are. By default "rolesim"; "rege" is also available. Fewer, identifiable letters, e.g. "ro" for RoleSim, is sufficient. See regularity_rolesim() and regularity_rege() for how they differ.

decay

A proportion between 0 and 1 giving how much of a contribution survives each additional step of distance or walk length. Lower values discount more steeply, so that only nearby others count; higher values discount less, so that longer walks continue to contribute. The measures that take a decay differ in what they discount and in what value leaves the measure in its most familiar form, so each documents its own default.

beta

Deprecated; use decay instead.

blocks

A character vector of permitted ideal block types, or a list-matrix giving the permitted types per block position. See net_by_inconsistency() for the available types.

times

Integer number of steps the search takes. By default the number of nodes times the number of positions. For search = "tabu" this is the most steps that each of its runs may take, since a run also ends once it stops improving.

search

Which method to use to search the space of partitions. One of "tabu" (the default) or "iterated"; see method_search for what each does.

Value

A node_member character vector the length of the nodes in the network, of group memberships "A", "B", etc for each node. If the network is labelled, then the assignments will be labelled with the nodes' names.

Regular equivalence

Two nodes are regularly equivalent if each has ties to the same kinds of others, even where those others are not the same individuals and are not equally numerous. A manager with three subordinates and a manager with ten are regularly equivalent, because what makes them alike is that they both have subordinates, not how many or which.

The definition is recursive: nodes are equivalent if their alters are equivalent, whose equivalence depends in turn on their alters. node_in_regular() therefore computes a similarity matrix by iterating that definition to a fixed point, and then clusters that similarity directly, rather than comparing nodes' profiles first as the other functions here do. Give distance to compare the nodes' similarities a second time.

Note that this differs from node_in_motif(), which compares nodes on how often they appear embedded in local structures. Two nodes can have very similar triad profiles without being regularly equivalent, and vice versa, since a motif census counts a node's local configurations while regular equivalence asks who its alters are.

Motif equivalence

Where the other functions here compare nodes on whom they are tied to, node_in_motif() compares them on what kinds of local structure they sit in, by clustering a census of the triads (or, for two-mode networks, tetrads) each node participates in.

Note that the census counts the types of motif a node takes part in, and not the position it holds within them. In the path i→k→ji \rightarrow k \rightarrow j, for example, all three nodes return a profile of one 021C triad, although ii sends, kk mediates and jj receives. This is therefore neither Burt's role equivalence, which distinguishes those positions, nor the orbit-aware census of Ortmann and Brandes, which netrics does not yet offer.

What it captures is similarity of local embedding. It is well suited to distinguishing nodes that sit in dense, closed neighbourhoods from those that bridge open ones, but it is not regular equivalence: see node_in_regular() for that.

This function was called node_in_regular() prior to version 1.0.0.

Direct blockmodelling

The other functions here are indirect: they build a similarity between nodes, cluster it, and read a partition off the result. node_in_block() is direct. It searches the space of partitions for the one that best fits an ideal block structure, scoring each candidate with net_by_inconsistency() and keeping whichever is most consistent.

The advantage is that the criterion being optimised is the one you actually care about, rather than a similarity that stands in for it, and that ideal types other than "null and complete" become available — blocks = c("nul", "reg") searches directly for a regular-equivalence blockmodel. The cost is that the number of positions k must be chosen in advance, and that the search is stochastic: it begins from random partitions, so repeated runs may return different partitions and a longer search is more likely to find a good one.

By default the search is a tabu search, search_tabu(), which lets the positions take any size, and so can find a small core or one large position where the network has them. search = "iterated" uses search_iterated(), the only search available prior to version 1.1.0. It is quicker on a large network, but it holds the positions at near-equal size. Set a seed for reproducibility, and compare runs with net_by_inconsistency().

Source

https://github.com/aslez/concoR

References

On role equivalence

Burt, Ronald S. 1990. "Detecting role equivalence". Social Networks 12(1): 83-97. doi:10.1016/0378-8733(90)90023-3

On the orbit-aware census

Ortmann, Mark, and Ulrik Brandes. 2017. "Efficient orbit-aware triad and quad census in directed and undirected graphs". Applied Network Science 2(1): 13. doi:10.1007/s41109-017-0027-2

On direct blockmodelling

Doreian, Patrick, Vladimir Batagelj, and Anuska Ferligoj. 2005. Generalized Blockmodeling. Cambridge: Cambridge University Press. doi:10.1017/CBO9780511584176

See Also

Other memberships: member_brokerage, member_cliques, member_community, member_community_hier, member_community_link, member_community_modular, member_community_partition, member_community_spread, member_components, member_core, member_diffusion

Other nodal: mark_core, mark_degree, mark_diff, mark_nodes, mark_select_node, measure_accuracy_node, measure_assort_node, measure_broker_node, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_closure_node, measure_core, measure_diffusion_node, measure_diverse_node, member_brokerage, member_cliques, member_community, member_community_hier, member_community_modular, member_community_partition, member_community_spread, member_components, member_core, member_diffusion, motif_accuracy_node, motif_brokerage_node, motif_clique, motif_composition, motif_exposure, motif_node, motif_path

Examples

(nse <- node_in_structural(ison_algebra))
(nre <- node_in_regular(ison_southern_women))
(nme <- node_in_motif(ison_southern_women, cluster = "concor"))
if(require("sna", quietly = TRUE)){
(nae <- node_in_automorphic(ison_southern_women,
  k = "elbow"))
}
(nbm <- node_in_block(ison_adolescents, k = 3))
net_by_inconsistency(ison_adolescents, nbm)

Methods for equivalence clustering

Description

These functions are used to cluster some motif census object:

  • cluster_hierarchical() returns a hierarchical clustering object created by stats::hclust() on the proximities between nodes' profiles.

  • cluster_concor() returns a hierarchical clustering object created from a convergence of correlations procedure (CONCOR).

  • cluster_cosine() is deprecated; use cluster_hierarchical() with proximity = "cosine" instead.

These functions are not intended to be called directly, but are called within node_in_equivalence() and related functions. They are exported and listed here to provide more detailed documentation.

Usage

cluster_hierarchical(motif, distance = NULL, proximity = "pearson")

cluster_cosine(motif, distance = NULL)

cluster_concor(.data, motif)

Arguments

motif

A matrix returned by a ⁠node_x_*()⁠ function.

distance

Character string indicating which distance metric to pass on to stats::dist to compare nodes a second time, on their profiles of dissimilarities to all nodes. By default NULL, so that the proximities are clustered directly. Options include "euclidean", "maximum", "manhattan", "canberra", "binary", and "minkowski". Fewer, identifiable letters, e.g. "e" for Euclidean, is sufficient. Before v1.1.0 the default was "euclidean", so pass that to reproduce earlier results. Ignored when cluster = "concor".

proximity

Character string indicating how nodes' profiles should be compared, passed on to manynet::to_proximity(). By default "pearson", their correlation, but any measure offered there can be used, e.g. "cosine", "ruzicka", "overlap", "euclidean", or "hamming". Note that "jaccard" dichotomises a valued census; "ruzicka" is the weighted counterpart that keeps the counts. The proximities themselves are in the proximity element of the clustering, e.g. attr(node_in_structural(.data), "hc")$proximity, or can be made with manynet::to_proximity() from any census, using across = "rows" and dyad = "include". Ignored when cluster = "concor". "asis" clusters a motif that is already a node-by-node similarity. node_in_regular() does not take it, since ⁠regularity_*()⁠ already returns a node-by-node similarity, which is clustered as it is.

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

Value

A hierarchical clustering object created by stats::hclust(), with an additional distances element containing the distance matrix used for clustering and, for cluster_hierarchical(), a proximity element containing the node-by-node proximity matrix those distances were made from.

Hierarchical clustering

This method uses stats::hclust() to create a hierarchical clustering object from the proximities between nodes' profiles in the given motif census. First a matrix of how alike each pair of nodes' profiles are is created using manynet::to_proximity(), by default their Pearson correlation coefficients. Then a dissimilarity matrix is created by subtracting these proximities from 1, and this is given to stats::hclust() to enable dendrogram construction etc. Each pair of nodes is thus compared once.

Where distance is given, the nodes are compared a second time: stats::dist() measures the distance between each pair of nodes' profiles of dissimilarities to all nodes, and it is these distances that are clustered. This was the only behaviour before v1.1.0.

Some proximities, such as "count", "match", "crossmin", "maxcrossmin", and "covariance", are not bounded by 1. These are subtracted from the largest proximity observed instead, with a message, so that no dissimilarity is negative.

CONCOR

First a matrix of Pearson correlation coefficients between each pair of nodes' profiles in the given motif census is created. Then, again, we find the correlations of this square, symmetric matrix, and continue to do this iteratively until each entry is either 1 or -1. These values are used to split the data into two partitions, with members either holding the values 1 or -1. This procedure from census to convergence is then repeated within each block, allowing further partitions to be found. Unlike UCINET, partitions are continued until there are single members in each partition. Then a distance matrix is constructed from records of in which partition phase nodes were separated, and this is given to stats::hclust() so that dendrograms etc can be returned.

References

On CONCOR clustering

Breiger, Ronald L., Scott A. Boorman, and Phipps Arabie. 1975. "An Algorithm for Clustering Relational Data with Applications to Social Network Analysis and Comparison with Multidimensional Scaling". Journal of Mathematical Psychology, 12: 328-83. doi:10.1016/0022-2496(75)90028-0.


Methods for calculating coreness

Description

These functions calculate how core-like each node is, returning both a continuous coreness score and a core/periphery split that node_is_core(), node_by_core() and node_in_core() then use.

  • coreness_correlation() fits the network to an ideal core-periphery pattern by correlation.

  • coreness_rich() ranks nodes by strength and cuts where the tie weight to higher-ranked neighbours peaks.

  • coreness_transition() scores nodes with a transition function whose sharpness and core size are free parameters.

  • coreness_hub() scores nodes by how well they send to and receive from the core, which lets core and periphery differ by tie direction.

They differ in what they can use. coreness_rich() and coreness_hub() read tie direction and tie weights directly. coreness_correlation() and coreness_transition() compare the network against a symmetric ideal, so they symmetrise a directed network first and report that they have done so.

Usage

coreness_correlation(.data, direction = c("all", "out", "in"), starts = 5L)

coreness_rich(.data, direction = c("all", "out", "in"))

coreness_transition(
  .data,
  direction = c("all", "out", "in"),
  alpha = seq(0.2, 0.8, 0.2),
  beta = seq(0.2, 0.8, 0.2)
)

coreness_hub(.data, direction = c("all", "out", "in"))

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

direction

One of "all" (the default), "out", or "in". For a directed network, "out" scores nodes on the ties they send and "in" on the ties they receive. Ignored for undirected and two-mode networks.

starts

Integer number of starting points for the search, at most 9. By default 5. The starting points are fixed rather than random, so that two calls on the same network return the same answer.

alpha

Numeric vector of boundary sharpness values between 0 and 1, to aggregate over. By default seq(0.2, 0.8, 0.2).

beta

Numeric vector of core size values between 0 and 1, to aggregate over. By default seq(0.2, 0.8, 0.2).

Details

For multilevel networks, these methods read the network as a one-mode one, which is the shape its matrix already has. A multilevel network reports itself as two-mode, but holds ties within a mode as well as between them, so manynet::as_matrix() returns one square matrix over every node rather than a rectangular incidence matrix.

Value

A list with two elements:

  • coreness: a numeric vector between 0 and 1, one value per node, for how core-like each node is.

  • core: a logical vector, one value per node, TRUE for the core.

coreness_hub() adds out_core and in_core, the two core sets that a directed core-periphery structure distinguishes.

Correlation

Borgatti and Everett's continuous model gives each node a coreness cic_i between 0 and 1, and compares the network against the ideal pattern cicjc_i c_j in which two nodes are tied to the extent that both are core:

ρ=cor(Aij,cicj),i≠j\rho = \text{cor}(A_{ij}, c_i c_j), i \neq j

The coreness vector that maximises ρ\rho is the fitted model. Self-ties are excluded from the correlation, since no node is tied to itself and including the diagonal pulls every coreness toward zero.

The problem is not convex, so the search is run from several starting points, ordered by degree, and the best fit is kept. A weighted network is fitted to its weights, which means that the ideal pattern is read as how strongly two core nodes should be tied. To fit the pattern of ties instead of their weights, use manynet::to_unweighted() first.

The search has one free value per node, so its cost grows quickly with the size of the network. On a large network, lower starts, or use coreness_rich(), which needs no search at all.

Rich-core

Ma and Mondragon rank the nodes by strength, from strongest to weakest, and give each node the total weight of its ties to nodes that rank above it:

σi+=∑j:rj<riwij\sigma_i^+ = \sum_{j : r_j < r_i} w_{ij}

Walking down the ranking, σ+\sigma^+ rises while the nodes added are still tied to those already above them, and falls once they are not. The rank at which it peaks is the boundary of the rich core.

The method needs no parameters and no optimisation, and it reads tie weights and tie direction directly, which makes it the method this package uses by default for a weighted, directed, or two-mode network. For a two-mode network the nodes of both modes are ranked together, so the core may span both.

Note that the core it finds is one whose members are tied to each other. Where a directed network instead has one set that sends and a different set that receives, σ+\sigma^+ never rises, and the method returns a core of one or two nodes. Use coreness_hub() for that structure, which keeps the two sets apart rather than trying to merge them.

A rich core is not a rich club, which is why this method is not named for one. A rich club requires the high-degree nodes to be densely tied to one another, and net_by_richclub() measures that density. A rich core only marks the rank at which nodes stop linking upward, so a network can have a rich core whose members are not densely tied. The rich core also needs no null model, where the rich-club coefficient does, since that coefficient rises with degree even in a random network.

Transition

Rombach and colleagues score the node at rank mm with a transition function

Cm=11+exp⁡(−(m−Nβ)tan⁡(πα/2))C_m = \frac{1}{1 + \exp(-(m - N\beta)\tan(\pi\alpha/2))}

where α\alpha sets how sharp the boundary between core and periphery is, from fuzziest at 0 to a clean step at 1, and β\beta sets how large the core is, from every node at 0 to none at 1. The ordering that maximises the core quality R=∑ijAijCiCjR = \sum_{ij} A_{ij} C_i C_j is the fitted model.

No single α\alpha and β\beta is right for every network, so the score is aggregated over a grid of both, weighting each by the core quality it achieves, and scaled so that the most core-like node is 1.

Hub

In a directed network a node can be core in whom it reaches and peripheral in who reaches it. Elliott and colleagues therefore keep two core sets rather than one: an out-core of nodes that send to the core, and an in-core of nodes that receive from it.

The two are read from the hub and authority scores that node_by_hub() and node_by_authority() already provide: a hub is a node that points to good authorities, and an authority is a node that good hubs point to, which is the same mutual definition the two core sets have. Each set is then cut by the same rule the other methods use. With direction = "all" the returned coreness is the geometric mean of the two scores, and the core is the set of nodes in both.

References

On the correlation method

Borgatti, Stephen P., and Martin G. Everett. 2000. "Models of core/periphery structures". Social Networks 21(4): 375-395. doi:10.1016/S0378-8733(99)00019-2

Lip, Sean Z. W. 2011. "A fast algorithm for the discrete core/periphery bipartitioning problem". doi:10.48550/arXiv.1102.5511

On the rich-core method

Ma, Athen, and Raul J. Mondragon. 2015. "Rich-cores in networks". PLoS ONE 10(3): e0119678. doi:10.1371/journal.pone.0119678

On the transition method

Rombach, Puck, Mason A. Porter, James H. Fowler, and Peter J. Mucha. 2017. "Core-periphery structure in networks (revisited)". SIAM Review 59(3): 619-646. doi:10.1137/17M1130046

On the hub method

Elliott, Andrew, Angus Chiu, Marya Bazzi, Gesine Reinert, and Mihai Cucuringu. 2020. "Core-periphery structure in directed networks". Proceedings of the Royal Society A 476(2241): 20190783. doi:10.1098/rspa.2019.0783

See Also

Other methods: method_regularity

Examples

coreness_correlation(ison_adolescents)
coreness_rich(ison_networkers)
coreness_transition(ison_adolescents)
coreness_hub(ison_networkers)

Methods for selecting clusters

Description

Finding the optimal number of clusters is generally a balance between optimal fit statistics, parsimony, and interpretability. These functions help select the number of clusters to return from hc, some hierarchical clustering object:

  • k_strict() selects a number of clusters in which there is no distance between cluster members.

  • k_elbow() selects a number of clusters in which there is a fair trade-off between parsimony and fit according to the elbow method.

  • k_silhouette() selects a number of clusters that maximises the silhouette score.

These functions are generally not user-facing but used internally in e.g. the ⁠*_equivalence()⁠ functions.

Usage

k_strict(hc, .data)

k_elbow(hc, .data, motif, max_k)

k_silhouette(hc, .data, max_k)

k_gap(hc, motif, max_k, sims = 100)

Arguments

hc

A hierarchical clustering object.

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

motif

A motif census object.

max_k

An integer indicating the maximum number of options to consider. The minimum of this and the number of nodes in the network is used.

sims

Integer of how many simulations should be generated as a reference distribution.

Value

A single integer indicating the number of clusters to return.

Strict method

The strict method selects the number of clusters in which there is no distance between cluster members. This is a very conservative method that may be appropriate when the goal is to identify clusters of nodes that are exactly the same. However, it may not be appropriate in cases where the data is noisy or when the clusters are not well-defined, as it may result in a large number of small clusters.

Elbow method

The elbow method is a heuristic used in cluster analysis to determine the optimal number of clusters. It is based on the idea of plotting the within cluster correlation as a function of the number of clusters and looking for an "elbow" where there is a significant decrease in the rate of improvement in correlation as the number of clusters increases. The point at which the elbow occurs is often considered a good choice for the number of clusters, as it represents a balance between model complexity and fit to the data.

The elbow is located geometrically. A straight line is drawn between the first and the last point of the curve. The perpendicular distance from each point to this line is measured, and the point at the greatest distance is the elbow. Note that where the curve is close to a straight line, no point stands out and the method returns one of the endpoints.

Silhouette method

The silhouette method is based on the concept of cohesion and separation. Cohesion refers to how closely related the nodes within a cluster are, while separation refers to how distinct the clusters are from each other. The silhouette score combines these two concepts into a single metric that can be used to evaluate the quality of a clustering solution. The silhouette score is calculated as follows: For each node, calculate the average distance to all other nodes in the same cluster (a) and the average distance to all other nodes in the next nearest cluster (b). The silhouette score for each node is then calculated as:

S(i)=b−amax⁡(a,b)S(i) = \frac{b - a}{\max(a, b)}

A higher silhouette score indicates that the node is well-matched to its own cluster and poorly matched to neighboring clusters. The silhouette score for the entire clustering is the average silhouette score across all nodes. Maximizing the silhouette score across a range of potential clusterings allows researchers to identify the number of clusters that best captures the underlying structure of the data. It is particularly useful when the clusters are well-separated.

References

On the elbow method

Thorndike, Robert L. 1953. "Who Belongs in the Family?". Psychometrika, 18(4): 267–76. doi:10.1007/BF02289263.

On the silhouette method

Rousseeuw, Peter J. 1987. “Silhouettes: A Graphical Aid to the Interpretation and Validation of Cluster Analysis.” Journal of Computational and Applied Mathematics, 20: 53–65. doi:10.1016/0377-0427(87)90125-7.


Methods for calculating regularity

Description

These functions calculate how regularly equivalent each pair of nodes is, returning a similarity matrix that node_in_regular() then clusters.

  • regularity_rolesim() calculates RoleSim similarity.

  • regularity_rege() calculates REGE similarity.

Both are recursive: two nodes are similar to the extent that their alters are similar, which is the defining property of regular equivalence. They differ in how they pair up two nodes' alters.

Usage

regularity_rolesim(.data, decay = 0.15, beta = NULL)

regularity_rege(.data, iterations = 3)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

decay

A proportion between 0 and 1 giving how much of a contribution survives each additional step of distance or walk length. Lower values discount more steeply, so that only nearby others count; higher values discount less, so that longer walks continue to contribute. The measures that take a decay differ in what they discount and in what value leaves the measure in its most familiar form, so each documents its own default.

beta

Deprecated; use decay instead.

iterations

Integer number of iterations. By default 3 for regularity_rege(); regularity_rolesim() iterates to convergence.

Value

A square similarity matrix with one row and column per node.

RoleSim

RoleSim pairs up two nodes' alters by finding the maximal matching between them, that is, the one-to-one pairing that maximises total similarity, and then averages over it:

s(u,v)=(1−δ)∑(x,y)∈Ms(x,y)∣N(u)∣+∣N(v)∣−∣M∣+δs(u,v) = (1-\delta) \frac{\sum_{(x,y) \in M} s(x,y)}{|N(u)| + |N(v)| - |M|} + \delta

where MM is that matching and δ\delta is decay, which RoleSim calls β\beta; by default 0.15. Because each alter can be used only once, two nodes are similar only if their neighbourhoods can be lined up as wholes.

RoleSim satisfies the automorphic confirmation property, meaning that automorphically equivalent nodes always score 1, and it is a metric. It converges to a unique solution regardless of where it starts, so the result does not depend on initialisation.

REGE

REGE instead pairs each alter with its best counterpart, allowing the same alter to be used more than once:

s(u,v)=∑x∈N(u)max⁡y∈N(v)s(x,y)+∑y∈N(v)max⁡x∈N(u)s(x,y)∣N(u)∣+∣N(v)∣s(u,v) = \frac{\sum_{x \in N(u)} \max_{y \in N(v)} s(x,y) + \sum_{y \in N(v)} \max_{x \in N(u)} s(x,y)}{|N(u)| + |N(v)|}

Matching with replacement makes REGE more permissive than RoleSim: a node with many alters can be judged similar to one with few, if those few resemble all of the many. Which behaviour is wanted depends on whether having more alters of a kind is itself part of the role.

REGE is the algorithm UCINET implements, so use it when comparing results against that software. Unlike RoleSim it has no convergence guarantee and is sensitive to the number of iterations, so this is fixed rather than run to convergence.

Note that REGE is defined for valued networks, and weights each matched pair by how similar the two ties' strengths are. On an unweighted, connected network it is degenerate: since every node has an alter that matches every other node's alter perfectly, all nodes come out maximally equivalent, which is the correct but uninformative answer that the maximal regular equivalence of a connected graph is a single class. Use regularity_rolesim() for unweighted networks.

References

On RoleSim

Jin, Ruoming, Victor E. Lee, and Hui Hong. 2011. "Axiomatic ranking of network role similarity". Proceedings of the 17th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining: 922-930. doi:10.1145/2020408.2020561

On REGE

White, Douglas R., and Karl P. Reitz. 1983. "Graph and semigroup homomorphisms on networks of relations". Social Networks 5(2): 193-234. doi:10.1016/0378-8733(83)90025-4

See Also

Other methods: method_coreness


Methods for splitting a continuous score into ordered groups

Description

These functions split a continuous score, such as a coreness score, into an ordered set of groups:

  • split_bins() cuts the range into equal-width bins.

  • split_quantiles() cuts at the quantiles, so each group holds a similar number of nodes.

  • split_kmeans() clusters the scores by k-means, so the cuts fall where the scores themselves are furthest apart.

These functions are not intended to be called directly, but are called within node_in_core() and related functions. They are exported and listed here to provide more detailed documentation.

Usage

split_bins(scores, groups)

split_quantiles(scores, groups)

split_kmeans(scores, groups)

Arguments

scores

A numeric vector of scores to split.

groups

An integer indicating the number of groups to split into.

Value

An integer vector the length of scores, giving each score's group index, numbered from the lowest score upwards.

Bins

Cuts the observed range into groups intervals of equal width. Where the scores are unevenly spread, a bin can end up empty, so this returns the coarsest picture of the three.

Quantiles

Cuts at the quantiles of the scores, so each group holds a similar number of nodes whatever the shape of the distribution.

K-means

Clusters the scores by k-means, so the cuts fall where the scores are furthest apart rather than at fixed widths or counts.

Examples

split_bins(c(0, 0.1, 0.4, 0.9, 1), 3)
split_quantiles(c(0, 0.1, 0.4, 0.9, 1), 3)
split_kmeans(c(0, 0.1, 0.4, 0.9, 1), 3)

Motifs of reporter accuracy

Description

node_x_accuracy() counts, for each node's report of a cognitive social structure, the possible ties on which it agrees or disagrees with an ideal network. The four columns are the confusion matrix of the report:

  • true_positives: ties in both the report and the ideal.

  • false_positives: ties in the report but not in the ideal.

  • false_negatives: ties in the ideal but not in the report.

  • true_negatives: ties in neither.

From these, e.g. a node's sensitivity is true_positives / (true_positives + false_negatives), and its specificity is true_negatives / (true_negatives + false_positives). For the ideal, see node_by_accuracy().

Usage

node_x_accuracy(.data, ideal = NULL)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

ideal

The ideal network to compare each report against, with the same nodes as the network. By default, the locally aggregated structure of the network itself.

Value

A node_motif matrix with one row for each node in the network and a column for each motif type, giving the count of each motif in which each node participates. It is printed as a tibble, however, to avoid greedy printing. If the network is labelled, then the node names will be in a column named names.

See Also

Other features: measure_accuracy_net, measure_accuracy_node, measure_features, measure_fit

Other motifs: motif_brokerage_net, motif_brokerage_node, motif_clique, motif_composition, motif_exposure, motif_hazard, motif_hierarchy, motif_homophily, motif_net, motif_node, motif_path, motif_periods

Other nodal: mark_core, mark_degree, mark_diff, mark_nodes, mark_select_node, measure_accuracy_node, measure_assort_node, measure_broker_node, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_closure_node, measure_core, measure_diffusion_node, measure_diverse_node, member_brokerage, member_cliques, member_community, member_community_hier, member_community_modular, member_community_partition, member_community_spread, member_components, member_core, member_diffusion, member_equivalence, motif_brokerage_node, motif_clique, motif_composition, motif_exposure, motif_node, motif_path

Examples

node_x_accuracy(ison_hightech)

Motifs of network brokerage

Description

net_x_brokerage() returns the Gould-Fernandez brokerage roles in a network.

Usage

net_x_brokerage(.data, membership, standardized = FALSE)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

membership

A character string naming an existing node attribute in the network, or a categorical vector of the same length as the number of nodes in the network where each element indicates the group membership of the corresponding node. While this may often be a vector created using ⁠node_in_*()⁠ functions, it can be any character vector that assigns nodes to groups or categories.

standardized

Logical scalar. Where TRUE, the counts are returned as z-scores against a null model rather than as raw counts. This is a different quantity from normalized, which divides by a theoretical maximum, and from scaled, which divides by the observed maximum: a z-score says how far the count departs from what the null model expects, so it can be negative and has no fixed range. By default FALSE.

Value

A network_motif named numeric vector or sometimes a data frame with one row and a column for each motif type, giving the count of each motif in the network. This is printed as a tibble to avoid greedy printing of long vectors.

See Also

Other brokerage: measure_broker_node, measure_broker_tie, measure_brokerage, member_brokerage, motif_brokerage_node

Other motifs: motif_accuracy_node, motif_brokerage_node, motif_clique, motif_composition, motif_exposure, motif_hazard, motif_hierarchy, motif_homophily, motif_net, motif_node, motif_path, motif_periods

Examples

net_x_brokerage(ison_networkers, "Discipline")

Motifs of node brokerage

Description

node_x_brokerage() returns the Gould-Fernandez brokerage roles played by nodes in a network.

Usage

node_x_brokerage(.data, membership, standardized = FALSE)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

membership

A character string naming an existing node attribute in the network, or a categorical vector of the same length as the number of nodes in the network where each element indicates the group membership of the corresponding node. While this may often be a vector created using ⁠node_in_*()⁠ functions, it can be any character vector that assigns nodes to groups or categories.

standardized

Logical scalar. Where TRUE, the counts are returned as z-scores against a null model rather than as raw counts. This is a different quantity from normalized, which divides by a theoretical maximum, and from scaled, which divides by the observed maximum: a z-score says how far the count departs from what the null model expects, so it can be negative and has no fixed range. By default FALSE.

Value

A node_motif matrix with one row for each node in the network and a column for each motif type, giving the count of each motif in which each node participates. It is printed as a tibble, however, to avoid greedy printing. If the network is labelled, then the node names will be in a column named names.

References

On brokerage motifs

Gould, Roger V., and Roberto M. Fernandez. 1989. “Structures of Mediation: A Formal Approach to Brokerage in Transaction Networks.” Sociological Methodology, 19: 89-126. doi:10.2307/270949

Jasny, Lorien, and Mark Lubell. 2015. “Two-Mode Brokerage in Policy Networks.” Social Networks 41:36–47. doi:10.1016/j.socnet.2014.11.005

See Also

Other brokerage: measure_broker_node, measure_broker_tie, measure_brokerage, member_brokerage, motif_brokerage_net

Other motifs: motif_accuracy_node, motif_brokerage_net, motif_clique, motif_composition, motif_exposure, motif_hazard, motif_hierarchy, motif_homophily, motif_net, motif_node, motif_path, motif_periods

Other nodal: mark_core, mark_degree, mark_diff, mark_nodes, mark_select_node, measure_accuracy_node, measure_assort_node, measure_broker_node, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_closure_node, measure_core, measure_diffusion_node, measure_diverse_node, member_brokerage, member_cliques, member_community, member_community_hier, member_community_modular, member_community_partition, member_community_spread, member_components, member_core, member_diffusion, member_equivalence, motif_accuracy_node, motif_clique, motif_composition, motif_exposure, motif_node, motif_path

Examples

node_x_brokerage(ison_networkers, "Discipline")

Motifs of clique participation

Description

node_x_clique() returns which maximal cliques each node belongs to.

A clique is a set of nodes every one of which is tied to every other, and it is maximal if no further node can be added without breaking that. Cliques are the strictest notion of a cohesive subgroup, and unlike the communities returned by ⁠node_in_*()⁠ functions they overlap: a node may belong to many cliques at once, or to none. That is why this returns an incidence table rather than a membership vector.

node_x_percolation() returns which communities of adjacent cliques each node belongs to, by clique percolation. These communities also overlap, but there are fewer of them than there are cliques, since cliques that share most of their nodes are joined.

Usage

node_x_clique(.data, min_clique_size = 3)

node_x_percolation(.data, min_clique_size = 3)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

min_clique_size

Integer, the minimum size of clique to return. By default 3, since dyads and isolates are trivially cliques. For a two-mode network, a vector of two values giving the minimum number of nodes from each mode, by default c(3, 3).

Details

For signed networks, only the positive ties are considered. Since a clique is a maximally cohesive subgroup, negative ties cannot contribute to one. Use manynet::to_unsigned() first to control this yourself.

Value

A node_motif matrix with one row for each node in the network and a column for each motif type, giving the count of each motif in which each node participates. It is printed as a tibble, however, to avoid greedy printing. If the network is labelled, then the node names will be in a column named names.

Bicliques

In a two-mode network no two nodes of the same mode are ever tied directly, so no set of them is a clique in the ordinary sense. The two-mode analogue is a biclique: a set of nodes from each mode such that every node of the one is tied to every node of the other. node_x_clique() detects these by connecting nodes that share a partner before searching, so that a biclique becomes an ordinary clique, and then keeping only those cliques with at least min_clique_size nodes from each mode.

Clique percolation

Clique percolation (Palla et al. 2005) treats two cliques as adjacent where they share all but one of min_clique_size nodes, so with the default of 3 where they share a tie. A community is then a set of cliques that can be reached from each other through such adjacent cliques, and a node belongs to every community that holds a clique it is in. A node in no clique of at least min_clique_size belongs to none.

References

On cliques

Luce, R. Duncan, and Albert D. Perry. 1949. "A method of matrix analysis of group structure". Psychometrika 14(2): 95-116. doi:10.1007/BF02289146

On clique percolation

Palla, Gergely, Imre Derényi, Illés Farkas, and Tamás Vicsek. 2005. "Uncovering the overlapping community structure of complex networks in nature and society". Nature 435(7043): 814-818. doi:10.1038/nature03607

See Also

Other motifs: motif_accuracy_node, motif_brokerage_net, motif_brokerage_node, motif_composition, motif_exposure, motif_hazard, motif_hierarchy, motif_homophily, motif_net, motif_node, motif_path, motif_periods

Other nodal: mark_core, mark_degree, mark_diff, mark_nodes, mark_select_node, measure_accuracy_node, measure_assort_node, measure_broker_node, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_closure_node, measure_core, measure_diffusion_node, measure_diverse_node, member_brokerage, member_cliques, member_community, member_community_hier, member_community_modular, member_community_partition, member_community_spread, member_components, member_core, member_diffusion, member_equivalence, motif_accuracy_node, motif_brokerage_node, motif_composition, motif_exposure, motif_node, motif_path

Examples

node_x_clique(ison_adolescents)
node_x_clique(ison_southern_women, min_clique_size = c(3, 3))
node_x_percolation(ison_adolescents)

Motifs of ego-network composition

Description

These functions describe the composition of each node's ego-network, that is, what the ties and alters surrounding each node look like:

  • node_x_ties() describes the distribution of each node's tie values, or, in a multiplex network, how its ties are spread across layers.

  • node_x_alters() describes the composition of each node's alters on some attribute.

  • node_x_similarity() describes how similar each node is to its alters on some attribute, or, in a two-mode network, to those it shares a node of the other mode with.

Where the corresponding ⁠node_by_*()⁠ measures collapse this information into a single score per node, these return the whole table, which is often what is wanted when exploring ego-networks. Each branches internally on the type of network or attribute given, so the same function serves weighted, multiplex, and two-mode networks, and categorical as well as continuous attributes.

Usage

node_x_ties(.data, direction = c("all", "out", "in"))

node_x_alters(
  .data,
  attribute,
  direction = c("all", "out", "in", "reciprocated")
)

node_x_similarity(.data, attribute)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

direction

Character string, “out” bases the measure on outgoing ties, “in” on incoming ties, and "all" on either/the sum of the two. By default "all".

attribute

Name of a nodal attribute, mark, measure, or membership vector.

Value

A node_motif matrix with one row for each node in the network and a column for each motif type, giving the count of each motif in which each node participates. It is printed as a tibble, however, to avoid greedy printing. If the network is labelled, then the node names will be in a column named names.

Tie composition

For a weighted network this returns the distribution of each node's tie values: how many ties it has, and the sum, mean, standard deviation, and quartiles of their strengths. Two nodes may have the same weighted degree while one spreads its involvement evenly and the other concentrates it in a single strong tie, and it is the spread rather than the total that distinguishes them.

For a multiplex network it instead returns one column per layer, giving each node's degree in that layer (or its strength, where the layer is itself weighted), together with Diversity, the index of qualitative variation across the layers. This is 0 where a node's ties all fall in a single layer, and 1 where they are spread evenly across all of them. Layers are taken by name, so a network multiplexed on any attribute is covered, not only one multiplexed on type. Every column stays the length of the whole nodeset, so a node holding no tie in a layer scores 0 there rather than dropping out. Where the interest is in just two of the layers, node_by_multidegree() gives the ratio between them.

For an unweighted, uniplex network only the degree is available, so this returns that alone. Isolates have no ties to summarise and so take NA for the distributional columns.

In a directed network, direction selects whose ties are described: a node's outgoing ties, its incoming ties, or both together. Note that under "all" a reciprocated pair is treated as a single relationship of combined strength, so Ties counts a node's distinct alters rather than its arcs, while Sum matches its total degree.

Alter composition

Where the attribute is categorical, this returns how many of each node's alters fall into each category, weighted by tie strength where the network is weighted. Where it is continuous, this returns the sum, tie-strength weighted sum, mean, tie-strength weighted mean, minimum, maximum, range, and standard deviation of the attribute across each node's alters.

The two weighted columns answer different questions. The weighted mean (Weighted) differs from the mean wherever a node's ties are of unequal strength: it describes the attribute of the alters a node is most involved with, rather than of its alters as an undifferentiated set. The weighted sum (WeightedSum) instead multiplies each alter's value by the strength of the tie to it, as where a tie's weight is an amount of exposure to that alter. On an unweighted network these equal the mean and the sum.

Alters whose value is missing are left out of the summary. Nodes with no alters of known value, including isolates, take NA.

In a directed network, direction selects which alters are described: those a node sends ties to ("out"), those it receives ties from ("in"), those it does either with ("all"), or those it does both with ("reciprocated"). Under "all" and "reciprocated", an alter counts once, with the combined strength of the ties in both directions.

In a two-mode network where the attribute is held by one mode alone, a node of that mode has no alters of known value at distance one. Each node of that mode is instead described by its alters at distance two, the nodes of its own mode that it shares a node of the other mode with, weighted by how many it shares (see Tertius similarity below). Each node of the other mode is described by its alters at distance one, which hold the attribute. Where both modes hold the attribute, every node is described by its alters at distance one. direction applies to one-mode networks only: a two-mode network is read as undirected.

Any tie counts as a tie here, whatever its sign, and by its magnitude. Apply manynet::to_unsigned() first to consider only positive or only negative ties.

Ego-alter similarity

Where the attribute is categorical, this returns each node's own two-by-two table of whether a tie is present and whether the alter shares its category, together with the summaries built from it: the proportion of a node's ties that are to others of the same category (PctSame), the EI index (EI), which runs from -1 where all of a node's ties are internal to its own category to +1 where all are external, the odds ratio and its logarithm, and Yule's Q.

The EI index and the odds ratio answer different questions. EI describes the mix of a node's ties, and so is sensitive to how large its category is: in a small category even an indifferent node will have mostly external ties. The odds ratio and Yule's Q instead compare the ties a node made against the ties it could have made, and so are not.

Where the attribute is continuous, this returns the mean difference, mean absolute difference, and mean squared difference between a node and its alters, followed by three measures of dyadic similarity averaged over a node's alters: Zegers' coefficient, the ratio of the smaller value to the larger, and the product.

Tertius similarity

In a two-mode network no two nodes of the same mode are ever tied, so similarity to one's alters cannot be measured directly. Instead, each node is compared here with those it shares a node of the other mode with, that is, its alters at distance two. This is the tertius neighbourhood used by the tertius() effect in {migraph} and {goldfish}, and described in Haunss and Hollway (2023): in a discourse network, for example, the actors an actor is compared with are those making claims about the same concepts.

The same columns are returned as for a one-mode network, but read at distance two: a node's alters are those it shares some other-mode node with, however many they share, and the non-alters are the remaining nodes of its own mode. Nodes of the other mode are neither alters nor non-alters, and so are excluded rather than counted as absent ties. Since a node's alters are always of its own mode, only that mode's values of the attribute are used; where an attribute is held by one mode alone, the other mode's nodes take NA.

References

On tertius effects

Haunss, Sebastian, and James Hollway. 2023. "Multimodal mechanisms of political discourse dynamics and the case of Germany's nuclear energy phase-out". Network Science 11(2): 205-223. doi:10.1017/nws.2022.31

On the EI index

Krackhardt, David, and Robert N. Stern. 1988. "Informal Networks and Organizational Crises: An Experimental Simulation". Social Psychology Quarterly 51(2): 123-140. doi:10.2307/2786835

On Yule's Q

Yule, G. Udny. 1912. "On the Methods of Measuring Association Between Two Attributes". Journal of the Royal Statistical Society 75(6): 579-652. doi:10.2307/2340126

See Also

Other motifs: motif_accuracy_node, motif_brokerage_net, motif_brokerage_node, motif_clique, motif_exposure, motif_hazard, motif_hierarchy, motif_homophily, motif_net, motif_node, motif_path, motif_periods

Other diversity: measure_assort_net, measure_assort_node, measure_diverse_net, measure_diverse_node, measure_diverse_tie, motif_homophily

Other nodal: mark_core, mark_degree, mark_diff, mark_nodes, mark_select_node, measure_accuracy_node, measure_assort_node, measure_broker_node, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_closure_node, measure_core, measure_diffusion_node, measure_diverse_node, member_brokerage, member_cliques, member_community, member_community_hier, member_community_modular, member_community_partition, member_community_spread, member_components, member_core, member_diffusion, member_equivalence, motif_accuracy_node, motif_brokerage_node, motif_clique, motif_exposure, motif_node, motif_path

Examples

node_x_ties(ison_networkers)
node_x_ties(ison_algebra)
node_x_ties(fict_marvel)
node_x_alters(ison_networkers, "Discipline")
node_x_alters(ison_networkers, "Citations")
node_x_alters(ison_networkers, "Citations", direction = "reciprocated")
node_x_alters(ison_southern_women, "Title")
node_x_similarity(ison_networkers, "Discipline")
node_x_similarity(ison_southern_women, "Title")

Motifs of node exposure

Description

node_x_exposure() produces a motif matrix of nodes' exposure to infection/adoption by time step.

Usage

node_x_exposure(.data)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

Value

A node_motif matrix with one row for each node in the network and a column for each motif type, giving the count of each motif in which each node participates. It is printed as a tibble, however, to avoid greedy printing. If the network is labelled, then the node names will be in a column named names.

See Also

Other diffusion: mark_diff, measure_diffusion_infection, measure_diffusion_net, measure_diffusion_node, member_diffusion, motif_hazard

Other motifs: motif_accuracy_node, motif_brokerage_net, motif_brokerage_node, motif_clique, motif_composition, motif_hazard, motif_hierarchy, motif_homophily, motif_net, motif_node, motif_path, motif_periods

Other nodal: mark_core, mark_degree, mark_diff, mark_nodes, mark_select_node, measure_accuracy_node, measure_assort_node, measure_broker_node, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_closure_node, measure_core, measure_diffusion_node, measure_diverse_node, member_brokerage, member_cliques, member_community, member_community_hier, member_community_modular, member_community_partition, member_community_spread, member_components, member_core, member_diffusion, member_equivalence, motif_accuracy_node, motif_brokerage_node, motif_clique, motif_composition, motif_node, motif_path

Examples

node_x_exposure(play_diffusion(create_tree(12)))

Motifs of network hazard

Description

net_x_hazard() measures the hazard rate or instantaneous probability that nodes will adopt/become infected at that time.

Usage

net_x_hazard(.data)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

Value

A network_motif named numeric vector or sometimes a data frame with one row and a column for each motif type, giving the count of each motif in the network. This is printed as a tibble to avoid greedy printing of long vectors.

Hazard rate

The hazard rate is the instantaneous probability of adoption/infection at each time point (Allison 1984). In survival analysis, hazard rate is formally defined as:

λ(t)=lim⁡h→+0F(t+h)−F(t)h11−F(t)% \lambda(t)=\lim_{h\to +0}\frac{F(t+h)-F(t)}{h}\frac{1}{1-F(t)} %

By approximating h=1h=1, we can rewrite the equation as

λ(t)=F(t+1)−F(t)1−F(t)% \lambda(t)=\frac{F(t+1)-F(t)}{1-F(t)} %

If we estimate F(t)F(t), the probability of not having adopted the innovation in time tt, from the proportion of adopters in that time, such that F(t)∼qt/nF(t) \sim q_t/n, we now have (ultimately for t>1t>1):

λ(t)=qt+1/n−qt/n1−qt/n=qt+1−qtn−qt=qt−qt−1n−qt−1% \lambda(t)=\frac{q_{t+1}/n-q_t/n}{1-q_t/n} = \frac{q_{t+1} - q_t}{n - q_t} = \frac{q_t - q_{t-1}}{n - q_{t-1}} %

where qiq_i is the number of adopters in time tt, and nn is the number of vertices in the graph.

The shape of the hazard rate indicates the pattern of new adopters over time. Rapid diffusion with convex cumulative adoption curves will have hazard functions that peak early and decay over time. Slow concave cumulative adoption curves will have hazard functions that are low early and rise over time. Smooth hazard curves indicate constant adoption whereas those that oscillate indicate variability in adoption behavior over time.

Source

{netdiffuseR}

References

On hazard rates

Allison, Paul D. 1984. Event history analysis: Regression for longitudinal event data. London: Sage Publications. doi:10.4135/9781412984195

Wooldridge, Jeffrey M. 2010. Econometric Analysis of Cross Section and Panel Data (2nd ed.). Cambridge: MIT Press.

See Also

Other diffusion: mark_diff, measure_diffusion_infection, measure_diffusion_net, measure_diffusion_node, member_diffusion, motif_exposure

Other motifs: motif_accuracy_node, motif_brokerage_net, motif_brokerage_node, motif_clique, motif_composition, motif_exposure, motif_hierarchy, motif_homophily, motif_net, motif_node, motif_path, motif_periods

Examples

# To calculate the hazard rates at each time point
  smeg <- generate_smallworld(15, 0.025)
net_x_hazard(play_diffusion(smeg, transmissibility = 0.3))

Motifs of network hierarchy

Description

net_x_hierarchy() collects the measures of hierarchy into a single motif, which can be used to compare the relative hierarchy of different networks. The measures of hierarchy are:

  • net_by_connectedness() measures the proportion of dyads in the network that are reachable to one another, or the degree to which network is a single component.

  • net_by_efficiency() measures the Krackhardt efficiency score.

  • net_by_upperbound() measures the Krackhardt (least) upper bound score.

  • net_by_reciprocity() measures the proportion of ties in the network that are reciprocated, which is a measure of the degree to which the network is non-hierarchical.

Usage

net_x_hierarchy(.data)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

Value

A network_motif named numeric vector or sometimes a data frame with one row and a column for each motif type, giving the count of each motif in the network. This is printed as a tibble to avoid greedy printing of long vectors.

References

On hierarchy

Krackhardt, David. 1994. Graph theoretical dimensions of informal organizations. In Carley and Prietula (eds) Computational Organizational Theory, Hillsdale, NJ: Lawrence Erlbaum Associates. Pp. 89-111.

Everett, Martin, and David Krackhardt. 2012. “A second look at Krackhardt's graph theoretical dimensions of informal organizations.” Social Networks, 34: 159-163. doi:10.1016/j.socnet.2011.10.006

See Also

Other hierarchy: measure_hierarchy

Other motifs: motif_accuracy_node, motif_brokerage_net, motif_brokerage_node, motif_clique, motif_composition, motif_exposure, motif_hazard, motif_homophily, motif_net, motif_node, motif_path, motif_periods

Examples

net_x_hierarchy(ison_networkers)

Motifs of network homophily

Description

net_x_homophily() returns the two-by-two table from which network-level homophily is calculated, together with the summaries built from it.

Where net_by_heterophily() returns the EI index alone, this returns the counts it rests on, so that the index can be interpreted against the network's own composition.

Note that on a weighted network the two report different values. A contingency table counts ties, so net_x_homophily() treats every tie alike, whereas net_by_heterophily() sums tie weights and so gives more say to stronger ties. On unweighted networks the two agree exactly. Apply manynet::to_unweighted() first to compare them directly.

Usage

net_x_homophily(.data, attribute)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

attribute

Name of a nodal attribute, mark, measure, or membership vector.

Value

A network_motif named numeric vector or sometimes a data frame with one row and a column for each motif type, giving the count of each motif in the network. This is printed as a tibble to avoid greedy printing of long vectors.

Expected EI

The EI index depends on how large the categories are, not only on how nodes choose between them. A network split into two equal groups will have a lower EI than one in which a small minority is surrounded by a large majority, even if nodes in both are equally indifferent to category.

ExpectedEI gives the EI that would be observed if ties were distributed at random across all possible pairs, holding category sizes fixed. Comparing EI against it separates the network's mixing from its composition: an EI above the expected value indicates more crossing of category boundaries than chance alone would produce, and one below it indicates less.

References

On the EI index

Krackhardt, David, and Robert N. Stern. 1988. "Informal Networks and Organizational Crises: An Experimental Simulation". Social Psychology Quarterly 51(2): 123-140. doi:10.2307/2786835

See Also

Other motifs: motif_accuracy_node, motif_brokerage_net, motif_brokerage_node, motif_clique, motif_composition, motif_exposure, motif_hazard, motif_hierarchy, motif_net, motif_node, motif_path, motif_periods

Other diversity: measure_assort_net, measure_assort_node, measure_diverse_net, measure_diverse_node, measure_diverse_tie, motif_composition

Examples

net_x_homophily(ison_networkers, "Discipline")

Motifs of network cohesion

Description

These functions include ways to take a census of the motifs in a network:

  • net_x_dyad() returns a census of dyad motifs in a network.

  • net_x_triad() returns a census of triad motifs in a network.

  • net_x_tetrad() returns a census of tetrad motifs in a network.

The sections below first say how to read each census, and then how signs, layers, and attributes add to it.

Usage

net_x_dyad(.data, attribute = NULL, ...)

net_x_triad(.data, attribute = NULL, ...)

net_x_tetrad(.data, attribute = NULL, ...)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

attribute

Name of a nodal attribute, mark, measure, or membership vector.

...

Only net_x_triad() reads this, and only to take a second, two-mode network for the mixed census, which is deprecated; see the section on multiplex and multilevel networks.

Value

A network_motif named numeric vector or sometimes a data frame with one row and a column for each motif type, giving the count of each motif in the network. This is printed as a tibble to avoid greedy printing of long vectors.

Dyad census

The dyad census counts each pair of nodes by the ties between them, using the MAN labels of Holland and Leinhardt (1970):

  • Mutual: a tie in both directions

  • Asymmetric: a tie in one direction only

  • Null: no tie

In an undirected or two-mode network every tie is mutual, so only Mutual and Null are reported.

Triad census

The triad census counts each set of three nodes by the ties among them, using the labels of Davis and Leinhardt (1967) and Holland and Leinhardt (1970). The three digits give the number of mutual, asymmetric, and null dyads in the triad, and a letter tells apart triads with the same digits: D(own), U(p), C(yclic), or T(ransitive).

  • 003: no ties

  • 012: one asymmetric tie, A->B

  • 102: one mutual tie, A<->B

  • ⁠021D⁠: A<-B->C, one node sending to the two others

  • ⁠021U⁠: A->B<-C, one node receiving from the two others

  • ⁠021C⁠: A->B->C, a chain

  • ⁠111D⁠: A<->B<-C

  • ⁠111U⁠: A<->B->C

  • ⁠030T⁠: A->B<-C and A->C, a transitive triad

  • ⁠030C⁠: A<-B<-C and A->C, a cycle

  • 201: A<->B<->C, with A and C not tied

  • ⁠120D⁠: A<-B->C and A<->C

  • ⁠120U⁠: A->B<-C and A<->C

  • ⁠120C⁠: A->B->C and A<->C

  • 210: A->B<->C and A<->C

  • 300: A<->B<->C and A<->C, all ties mutual

In an undirected network every tie is read as mutual, so only 003, 102, 201, and 300 can occur.

Tetrad census

The tetrad census counts each set of four nodes by the ties among them. Ties are read as undirected. Each label gives a letter whose shape recalls the motif, and the number of nodes:

  • E4 (co-K4): no ties

  • I4 (co-diamond): one tie

  • H4 (co-C4): two ties that share no node

  • L4 (co-paw): two ties that share a node, and an isolate

  • D4 (co-claw): a triangle, and an isolate

  • U4 (P4): three ties in a line

  • Y4 (claw): three ties from one node

  • P4 (paw): a triangle, with one more tie to the fourth node

  • C4 (C4): four ties in a cycle

  • Z4 (diamond): a cycle with one diagonal

  • X4 (K4): all six ties

See also graph classes and McMillan and Felmlee (2020).

Splitting motifs

For signed networks, dyads and triads are split by the signs of their ties. Each label is followed by the signs of the motif's ties, e.g. ⁠300_++-⁠ for a triangle with one negative tie, or ⁠Mutual_+-⁠ for a mutual dyad whose two ties differ in sign. The ties are listed in a fixed order over the motif's positions (1-2, 1-3, 2-1, 2-3, 3-1, 3-2 in a directed triad; 1-2, 1-3, 2-3 in an undirected one), skipping the pairs that are not tied, with the positions ordered so that ties, and then positive ties, come as early as they can. A pair holding both a positive and a negative tie counts as negative. The tetrad census sets signs aside.

Only the motifs that occur are reported. Summing the variants of a motif gives the unsigned census. Use manynet::to_unsigned() first for a coarser census.

For multiplex networks, which hold several one-mode layers, dyads and triads are split by the layers of their ties. Each layer is given a letter, the first letter of its name where these differ, and the letters are kept in the "layers" attribute of the result. Each tie lists the letters of the layers that carry it, separated from the next tie by a ., in the order described for signed networks. A lowercase letter marks a positive tie and an uppercase letter a negative one, so ⁠201_f.ft⁠ is a two-path, one of whose ties is in the friends layer, and the other in both the friends and tasks layers. Only the motifs that occur are reported. Summing the variants of a motif gives the census of all layers together. Use manynet::to_uniplex() first for a census of one layer. The tetrad census counts every tie whatever its layer.

Where an attribute is given, each motif is further split by how its nodes compare on that attribute, after any signs or layers. The comparison is given for each pair of positions in turn (1-2 in a dyad; 1-2, 1-3, 2-3 in a triad; 1-2, 1-3, 1-4, 2-3, 2-4, 3-4 in a tetrad), using the same order of positions as the ties. For a categorical attribute (character, factor, or logical), = marks a pair that shares a category and ! a pair that does not, so ⁠021D_!!=⁠ is a node sending ties to two nodes that share a category other than its own. Missing values are a category of their own. For an ordered attribute (numeric, or an ordered factor), <, =, and > mark whether the first of the pair is lower than, equal to, or higher than the second, so ⁠021D_>><⁠ is a node sending ties to two nodes with lower values than its own. Missing values cannot be compared, so are not allowed. A numeric attribute that codes categories should be passed through as.factor() first.

Since only these comparisons are kept, an attribute may have any number of categories or values. Only the motifs that occur are reported, and summing the variants of a motif gives the census without the attribute. To see which categories take part in which motifs, take a node census and summarise its rows by the attribute.

Multilevel triad census

For multilevel networks that hold exactly one one-mode layer and one two-mode layer, such as fict_marvel, the triad census is instead the multilevel census of Hollway et al. (2017), over triads of two nodes of the first mode and one of the second. Its ten motifs are labelled by two digits: first, how many of the two first-mode nodes are tied to the second-mode node (2, 1, or 0); second, the tie between the two first-mode nodes (2 mutual, 1 asymmetric, 0 none): 22, 21, 20, 12, ⁠11D⁠, ⁠11U⁠, 10, 02, 01, 00. So 21 counts pairs tied in one direction that share an affiliation. Where only one of the pair is affiliated and the tie is asymmetric, ⁠11D⁠ has the affiliated node sending the tie, and ⁠11U⁠ receiving it. This census sets weights and signs aside, and takes no attribute. Passing the one-mode and two-mode networks separately still works, but is deprecated. Other combinations of one-mode and two-mode layers are not yet available.

References

On signed and attributed censuses

Schoch, David. 2023. "signnet: An R package for analyzing signed networks". Journal of Open Source Software 8(81): 4987. doi:10.21105/joss.04987

On the dyad census

Holland, Paul W., and Samuel Leinhardt. 1970. "A Method for Detecting Structure in Sociometric Data". American Journal of Sociology, 76: 492-513. doi:10.1016/B978-0-12-442450-0.50028-6

Wasserman, Stanley, and Katherine Faust. 1994. "Social Network Analysis: Methods and Applications". Cambridge: Cambridge University Press.

On the triad census

Davis, James A., and Samuel Leinhardt. 1967. “The Structure of Positive Interpersonal Relations in Small Groups.” 55.

Schoch, David. 2023. "signnet: An R package for analyzing signed networks". Journal of Open Source Software 8(81): 4987. doi:10.21105/joss.04987

Hollway, James, Alessandro Lomi, Francesca Pallotti, and Christoph Stadtfeld. 2017. “Multilevel Social Spaces: The Network Dynamics of Organizational Fields.” Network Science 5(2): 187–212. doi:10.1017/nws.2017.8

On the tetrad census

Ortmann, Mark, and Ulrik Brandes. 2017. “Efficient Orbit-Aware Triad and Quad Census in Directed and Undirected Graphs.” Applied Network Science 2(1):13. doi:10.1007/s41109-017-0027-2.

McMillan, Cassie, and Diane Felmlee. 2020. "Beyond Dyads and Triads: A Comparison of Tetrads in Twenty Social Networks". Social Psychology Quarterly 83(4): 383-404. doi:10.1177/0190272520944151

See Also

Other cohesion: mark_triangles, measure_breadth, measure_cohesion, measure_fragmentation, motif_node

Other motifs: motif_accuracy_node, motif_brokerage_net, motif_brokerage_node, motif_clique, motif_composition, motif_exposure, motif_hazard, motif_hierarchy, motif_homophily, motif_node, motif_path, motif_periods

Examples

net_x_dyad(manynet::ison_algebra)
net_x_triad(manynet::ison_adolescents)
net_x_triad(ison_networkers, attribute = "Discipline")
net_x_triad(to_uniplex(fict_marvel, "relationship"))
net_x_triad(fict_marvel)
net_x_tetrad(ison_southern_women)

Motifs of node cohesion

Description

These functions include ways to take a census of the positions of nodes in a network:

  • node_x_dyad() returns a census of the dyad configurations nodes are embedded in.

  • node_x_triad() returns a census of the triad configurations nodes are embedded in.

  • node_x_tetrad() returns a census of nodes' positions in motifs of four nodes.

The sections below first say how to read each census, and then how signs, layers, and attributes add to it. The ⁠node_x_*()⁠ functions use the same labels as the ⁠net_x_*()⁠ functions, with one row per node, counting the motifs that each node takes part in. They do not tell apart the positions a node can hold within a motif, so in the chain A->B->C all three nodes count one ⁠021C⁠.

Usage

node_x_dyad(.data, attribute = NULL, ...)

node_x_triad(.data, attribute = NULL, ...)

node_x_tetrad(.data, attribute = NULL, ...)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

attribute

Name of a nodal attribute, mark, measure, or membership vector.

...

Not used, but kept for symmetry with net_x_triad().

Value

A node_motif matrix with one row for each node in the network and a column for each motif type, giving the count of each motif in which each node participates. It is printed as a tibble, however, to avoid greedy printing. If the network is labelled, then the node names will be in a column named names.

Dyad census

The dyad census counts each pair of nodes by the ties between them, using the MAN labels of Holland and Leinhardt (1970):

  • Mutual: a tie in both directions

  • Asymmetric: a tie in one direction only

  • Null: no tie

In an undirected or two-mode network every tie is mutual, so only Mutual and Null are reported.

Triad census

The triad census counts each set of three nodes by the ties among them, using the labels of Davis and Leinhardt (1967) and Holland and Leinhardt (1970). The three digits give the number of mutual, asymmetric, and null dyads in the triad, and a letter tells apart triads with the same digits: D(own), U(p), C(yclic), or T(ransitive).

  • 003: no ties

  • 012: one asymmetric tie, A->B

  • 102: one mutual tie, A<->B

  • ⁠021D⁠: A<-B->C, one node sending to the two others

  • ⁠021U⁠: A->B<-C, one node receiving from the two others

  • ⁠021C⁠: A->B->C, a chain

  • ⁠111D⁠: A<->B<-C

  • ⁠111U⁠: A<->B->C

  • ⁠030T⁠: A->B<-C and A->C, a transitive triad

  • ⁠030C⁠: A<-B<-C and A->C, a cycle

  • 201: A<->B<->C, with A and C not tied

  • ⁠120D⁠: A<-B->C and A<->C

  • ⁠120U⁠: A->B<-C and A<->C

  • ⁠120C⁠: A->B->C and A<->C

  • 210: A->B<->C and A<->C

  • 300: A<->B<->C and A<->C, all ties mutual

In an undirected network every tie is read as mutual, so only 003, 102, 201, and 300 can occur.

Tetrad census

The tetrad census counts each set of four nodes by the ties among them. Ties are read as undirected. Each label gives a letter whose shape recalls the motif, and the number of nodes:

  • E4 (co-K4): no ties

  • I4 (co-diamond): one tie

  • H4 (co-C4): two ties that share no node

  • L4 (co-paw): two ties that share a node, and an isolate

  • D4 (co-claw): a triangle, and an isolate

  • U4 (P4): three ties in a line

  • Y4 (claw): three ties from one node

  • P4 (paw): a triangle, with one more tie to the fourth node

  • C4 (C4): four ties in a cycle

  • Z4 (diamond): a cycle with one diagonal

  • X4 (K4): all six ties

See also graph classes and McMillan and Felmlee (2020).

Splitting motifs

For signed networks, dyads and triads are split by the signs of their ties. Each label is followed by the signs of the motif's ties, e.g. ⁠300_++-⁠ for a triangle with one negative tie, or ⁠Mutual_+-⁠ for a mutual dyad whose two ties differ in sign. The ties are listed in a fixed order over the motif's positions (1-2, 1-3, 2-1, 2-3, 3-1, 3-2 in a directed triad; 1-2, 1-3, 2-3 in an undirected one), skipping the pairs that are not tied, with the positions ordered so that ties, and then positive ties, come as early as they can. A pair holding both a positive and a negative tie counts as negative. The tetrad census sets signs aside.

Only the motifs that occur are reported. Summing the variants of a motif gives the unsigned census. Use manynet::to_unsigned() first for a coarser census.

For multiplex networks, which hold several one-mode layers, dyads and triads are split by the layers of their ties. Each layer is given a letter, the first letter of its name where these differ, and the letters are kept in the "layers" attribute of the result. Each tie lists the letters of the layers that carry it, separated from the next tie by a ., in the order described for signed networks. A lowercase letter marks a positive tie and an uppercase letter a negative one, so ⁠201_f.ft⁠ is a two-path, one of whose ties is in the friends layer, and the other in both the friends and tasks layers. Only the motifs that occur are reported. Summing the variants of a motif gives the census of all layers together. Use manynet::to_uniplex() first for a census of one layer. The tetrad census counts every tie whatever its layer.

Where an attribute is given, each motif is further split by how its nodes compare on that attribute, after any signs or layers. The comparison is given for each pair of positions in turn (1-2 in a dyad; 1-2, 1-3, 2-3 in a triad; 1-2, 1-3, 1-4, 2-3, 2-4, 3-4 in a tetrad), using the same order of positions as the ties. For a categorical attribute (character, factor, or logical), = marks a pair that shares a category and ! a pair that does not, so ⁠021D_!!=⁠ is a node sending ties to two nodes that share a category other than its own. Missing values are a category of their own. For an ordered attribute (numeric, or an ordered factor), <, =, and > mark whether the first of the pair is lower than, equal to, or higher than the second, so ⁠021D_>><⁠ is a node sending ties to two nodes with lower values than its own. Missing values cannot be compared, so are not allowed. A numeric attribute that codes categories should be passed through as.factor() first.

Since only these comparisons are kept, an attribute may have any number of categories or values. Only the motifs that occur are reported, and summing the variants of a motif gives the census without the attribute. To see which categories take part in which motifs, take a node census and summarise its rows by the attribute.

Multilevel triad census

For multilevel networks that hold exactly one one-mode layer and one two-mode layer, such as fict_marvel, the triad census is instead the multilevel census of Hollway et al. (2017), over triads of two nodes of the first mode and one of the second. Its ten motifs are labelled by two digits: first, how many of the two first-mode nodes are tied to the second-mode node (2, 1, or 0); second, the tie between the two first-mode nodes (2 mutual, 1 asymmetric, 0 none): 22, 21, 20, 12, ⁠11D⁠, ⁠11U⁠, 10, 02, 01, 00. So 21 counts pairs tied in one direction that share an affiliation. Where only one of the pair is affiliated and the tie is asymmetric, ⁠11D⁠ has the affiliated node sending the tie, and ⁠11U⁠ receiving it. This census sets weights and signs aside, and takes no attribute. Passing the one-mode and two-mode networks separately still works, but is deprecated. Other combinations of one-mode and two-mode layers are not yet available.

References

On the dyad census

Holland, Paul W., and Samuel Leinhardt. 1970. "A Method for Detecting Structure in Sociometric Data". American Journal of Sociology, 76: 492-513. doi:10.1016/B978-0-12-442450-0.50028-6

On the triad census

Davis, James A., and Samuel Leinhardt. 1967. “The Structure of Positive Interpersonal Relations in Small Groups.” 55.

Schoch, David. 2023. "signnet: An R package for analyzing signed networks". Journal of Open Source Software 8(81): 4987. doi:10.21105/joss.04987

Hollway, James, Alessandro Lomi, Francesca Pallotti, and Christoph Stadtfeld. 2017. “Multilevel Social Spaces: The Network Dynamics of Organizational Fields.” Network Science 5(2): 187–212. doi:10.1017/nws.2017.8

On the tetrad census

Ortmann, Mark, and Ulrik Brandes. 2017. “Efficient Orbit-Aware Triad and Quad Census in Directed and Undirected Graphs.” Applied Network Science 2(1):13. doi:10.1007/s41109-017-0027-2.

McMillan, Cassie, and Diane Felmlee. 2020. "Beyond Dyads and Triads: A Comparison of Tetrads in Twenty Social Networks". Social Psychology Quarterly 83(4): 383-404. doi:10.1177/0190272520944151

See Also

Other cohesion: mark_triangles, measure_breadth, measure_cohesion, measure_fragmentation, motif_net

Other motifs: motif_accuracy_node, motif_brokerage_net, motif_brokerage_node, motif_clique, motif_composition, motif_exposure, motif_hazard, motif_hierarchy, motif_homophily, motif_net, motif_path, motif_periods

Other nodal: mark_core, mark_degree, mark_diff, mark_nodes, mark_select_node, measure_accuracy_node, measure_assort_node, measure_broker_node, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_closure_node, measure_core, measure_diffusion_node, measure_diverse_node, member_brokerage, member_cliques, member_community, member_community_hier, member_community_modular, member_community_partition, member_community_spread, member_components, member_core, member_diffusion, member_equivalence, motif_accuracy_node, motif_brokerage_node, motif_clique, motif_composition, motif_exposure, motif_path

Examples

node_x_dyad(ison_networkers)
node_x_dyad(ison_networkers, attribute = "Discipline")
task_eg <- to_named(to_uniplex(ison_algebra, "tasks"))
(triad_cen <- node_x_triad(task_eg))
node_x_tetrad(ison_southern_women)
node_x_tetrad(ison_adolescents, attribute = rep(c("x", "y"), 4))

Motifs of node pathing

Description

These functions include ways to take a census of the positions of nodes in a network:

  • node_x_tie() returns a census of the ties in a network. For directed networks, out-ties and in-ties are bound together. For multiplex networks, the various types of ties are bound together.

  • node_x_path() returns the shortest path lengths of each node to every other node in the network. Where the network is weighted, stronger ties are shorter steps: each tie costs the mean tie weight divided by its own weight. Nodes that cannot reach each other are an infinite distance apart.

Usage

node_x_tie(.data)

node_x_path(.data)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

Details

For multiplex networks, node_x_tie() binds the layers together, giving one block of columns per layer, whatever attribute the network is multiplexed on. Each block stays the length of the whole nodeset. To census one layer alone, take it first with manynet::to_uniplex().

For signed networks, node_x_path() considers only the positive ties. It reads a tie as a distance, and a negative tie is hostility rather than a channel along which cohesion travels. Use manynet::to_unsigned() first to control this yourself.

Value

A node_motif matrix with one row for each node in the network and a column for each motif type, giving the count of each motif in which each node participates. It is printed as a tibble, however, to avoid greedy printing. If the network is labelled, then the node names will be in a column named names.

References

On paths

Dijkstra, Edsger W. 1959. "A note on two problems in connexion with graphs". Numerische Mathematik 1, 269-71. doi:10.1007/BF01386390.

Opsahl, Tore, Filip Agneessens, and John Skvoretz. 2010. "Node centrality in weighted networks: Generalizing degree and shortest paths". Social Networks 32(3): 245-51. doi:10.1016/j.socnet.2010.03.006.

See Also

Other motifs: motif_accuracy_node, motif_brokerage_net, motif_brokerage_node, motif_clique, motif_composition, motif_exposure, motif_hazard, motif_hierarchy, motif_homophily, motif_net, motif_node, motif_periods

Other nodal: mark_core, mark_degree, mark_diff, mark_nodes, mark_select_node, measure_accuracy_node, measure_assort_node, measure_broker_node, measure_brokerage, measure_central_between, measure_central_close, measure_central_degree, measure_central_eigen, measure_closure_node, measure_core, measure_diffusion_node, measure_diverse_node, member_brokerage, member_cliques, member_community, member_community_hier, member_community_modular, member_community_partition, member_community_spread, member_components, member_core, member_diffusion, member_equivalence, motif_accuracy_node, motif_brokerage_node, motif_clique, motif_composition, motif_exposure, motif_node

Examples

task_eg <- to_named(to_uniplex(ison_algebra, "tasks"))
(tie_cen <- node_x_tie(task_eg))
node_x_path(ison_adolescents)
node_x_path(ison_southern_women)

Motifs of network change

Description

These functions measure certain topological features of networks:

  • net_x_change() measures the Hamming distance between two or more networks.

  • net_x_stability() measures the Jaccard index of stability between two or more networks.

  • net_x_correlation() measures the product-moment correlation between two or more networks.

These ⁠net_*()⁠ functions return a numeric vector the length of the number of networks minus one. E.g., the periods between waves. Cells that are missing in either network of a pair are left out.

Usage

net_x_change(.data, object2)

net_x_stability(.data, object2)

net_x_correlation(.data, object2)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

object2

A network object.

Value

A network_motif named numeric vector or sometimes a data frame with one row and a column for each motif type, giving the count of each motif in the network. This is printed as a tibble to avoid greedy printing of long vectors.

See Also

Other change: measure_periods

Other motifs: motif_accuracy_node, motif_brokerage_net, motif_brokerage_node, motif_clique, motif_composition, motif_exposure, motif_hazard, motif_hierarchy, motif_homophily, motif_net, motif_node, motif_path

Examples

net_x_change(ison_monks)
net_x_correlation(ison_monks)