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.

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.

Cognitive social structures

A cognitive social structure records each node's report of the ties in the whole network, in a by column that names who reported each tie. Counting every report as a tie of its own would count each tie once for every perceiver who reports it. So the functions here first combine the reports into the locally aggregated structure of Krackhardt (1987), with the intersection rule: a tie exists if both of its ends report it, and a message says so. A tie that names no reporter is kept as it is.

A tie-level function still returns one value for each report, so that the result can be added back to the network it was given. Each report takes the value of the tie that it reports. A report of a tie that is not in the aggregated structure takes NA, or FALSE for a mark. tie_is_random() is the exception, and draws among the reports.

To combine the reports in a different way, do this before the function, e.g. with manynet::to_aggregated(over = "by").

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

Multiplex networks

node_x_ties() returns one column per layer, plus a Diversity column, rather than the distribution of tie values it returns otherwise. 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.

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. 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

Examples

node_x_ties(ison_networkers)
#> # A tibble: 32 × 9
#>   names               Ties   Sum   Mean     SD   Min Median   Max   IQR
#>   <chr>              <dbl> <dbl>  <dbl>  <dbl> <dbl>  <dbl> <dbl> <dbl>
#> 1 Lin Freeman           31  5666 183.   230.      28  110     947   131
#> 2 Doug White            31  2333  75.3  157.       5   23     852    36
#> 3 Ev Rogers             11   115  10.5    8.80     4    9      32     5
#> 4 Richard Alba          19   653  34.4   30.0      4   25     117    43
#> 5 Phipps Arabie         28   244   8.71   9.76     4    4      46     4
#> 6 Carol Barner-Barry    16   453  28.3   34.0      4   15.5   137    28
#> # ℹ 26 more rows
node_x_ties(ison_algebra)
#> # A tibble: 16 × 4
#>   social tasks friends Diversity
#>    <dbl> <dbl>   <dbl>     <dbl>
#> 1     17    11       8     0.951
#> 2     14    11       9     0.984
#> 3     15     8      10     0.964
#> 4      3     4       0     0.735
#> 5     16    12      10     0.981
#> 6     15    11      10     0.984
#> # ℹ 10 more rows
node_x_ties(fict_marvel)
#> # A tibble: 53 × 4
#>   names         relationship affiliation Diversity
#>   <chr>                <dbl>       <dbl>     <dbl>
#> 1 Abomination             12           5     0.830
#> 2 Ant-Man                  7           9     0.984
#> 3 Apocalypse              14           2     0.438
#> 4 Beast                   32          15     0.869
#> 5 Black Panther           32          12     0.793
#> 6 Black Widow             19          15     0.986
#> # ℹ 47 more rows
#> # A tibble: 141 × 4
#>   names           relationship affiliation Diversity
#>   <chr>                  <dbl>       <dbl>     <dbl>
#> 1 A.I.M                      0           2         0
#> 2 A.Force                    0           8         0
#> 3 A.Next                     0           2         0
#> 4 Acolytes                   0           2         0
#> 5 Asgardian.Gods             0           2         0
#> 6 Assassins.Guild            0           4         0
#> # ℹ 135 more rows
node_x_alters(ison_networkers, "Discipline")
#> # A tibble: 32 × 5
#>   names              Anthropology Mathematics.Statistics Other Sociology
#>   <chr>                     <dbl>                  <dbl> <dbl>     <dbl>
#> 1 Lin Freeman                2106                    311   708      2541
#> 2 Doug White                  359                    128   425      1421
#> 3 Ev Rogers                    32                      0    23        60
#> 4 Richard Alba                209                     40    60       344
#> 5 Phipps Arabie                51                     12    34       147
#> 6 Carol Barner-Barry           79                     14    53       307
#> # ℹ 26 more rows
node_x_alters(ison_networkers, "Citations")
#> # A tibble: 32 × 9
#>   names                Sum WeightedSum  Mean Weighted   Min   Max Range    SD
#>   <chr>              <dbl>       <dbl> <dbl>    <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 Lin Freeman          714       66879  23.0     11.8     0   170   170  32.8
#> 2 Doug White           730       37695  23.5     16.2     0   170   170  32.6
#> 3 Ev Rogers            178        1741  16.2     15.1     0    46    46  13.8
#> 4 Richard Alba         297       10386  15.6     15.9     0    56    56  15.4
#> 5 Phipps Arabie        597        4005  21.3     16.4     0   170   170  32.7
#> 6 Carol Barner-Barry   289        6960  18.1     15.4     0    56    56  14.8
#> # ℹ 26 more rows
node_x_alters(ison_networkers, "Citations", direction = "reciprocated")
#> # A tibble: 32 × 9
#>   names                Sum WeightedSum  Mean Weighted   Min   Max Range    SD
#>   <chr>              <dbl>       <dbl> <dbl>    <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 Lin Freeman          596       63383  20.6     11.3     0   170   170 32.4 
#> 2 Doug White           518       34756  24.7     16.0     0   170   170 37.4 
#> 3 Ev Rogers             31         764  10.3     11.9     3    19    16  8.08
#> 4 Richard Alba         225       10042  13.2     15.6     0    40    40 12.7 
#> 5 Phipps Arabie         64        1825   8       11.7     0    19    19  7.67
#> 6 Carol Barner-Barry   234        6575  19.5     16.0     0    56    56 15.5 
#> # ℹ 26 more rows
node_x_alters(ison_southern_women, "Title")
#> # A tibble: 18 × 3
#>   names      Miss   Mrs
#>   <chr>     <dbl> <dbl>
#> 1 Evelyn       41     9
#> 2 Laura        32    13
#> 3 Theresa      38    19
#> 4 Brenda       33    13
#> 5 Charlotte    18     6
#> 6 Frances      24     8
#> # ℹ 12 more rows
#> # A tibble: 14 × 3
#>   names  Miss   Mrs
#>   <chr> <dbl> <dbl>
#> 1 E1        2     1
#> 2 E2        2     1
#> 3 E3        5     1
#> 4 E4        3     1
#> 5 E5        7     1
#> 6 E6        6     2
#> # ℹ 8 more rows
node_x_similarity(ison_networkers, "Discipline")
#> # A tibble: 32 × 10
#>   names      TieSame TieDiff NoTieSame NoTieDiff PctSame      EI   Odds  LogOdds
#>   <chr>        <dbl>   <dbl>     <dbl>     <dbl>   <dbl>   <dbl>  <dbl>    <dbl>
#> 1 Lin Freem…      16      15         0         0   0.516 -0.0323 NA       NA    
#> 2 Doug White       5      23         0         3   0.179  0.643  NA       NA    
#> 3 Ev Rogers        0       3         5        23   0      1       0     -Inf    
#> 4 Richard A…       8      10         8         5   0.444  0.111   0.5     -0.693
#> 5 Phipps Ar…       5      23         0         3   0.179  0.643  NA       NA    
#> 6 Carol Bar…       2      13         3        13   0.133  0.733   0.667   -0.405
#> # ℹ 26 more rows
#> # ℹ 1 more variable: YulesQ <dbl>
node_x_similarity(ison_southern_women, "Title")
#> # A tibble: 18 × 10
#>   names  TieSame TieDiff NoTieSame NoTieDiff PctSame     EI  Odds LogOdds YulesQ
#>   <chr>    <dbl>   <dbl>     <dbl>     <dbl>   <dbl>  <dbl> <dbl>   <dbl>  <dbl>
#> 1 Evelyn       6      11         0         0   0.353  0.294 NA     NA     NA    
#> 2 Laura       10       5         0         2   0.667 -0.333 NA     NA      1    
#> 3 There…      10       7         0         0   0.588 -0.176 NA     NA     NA    
#> 4 Brenda      10       5         0         2   0.667 -0.333 NA     NA      1    
#> 5 Charl…       7       4         3         3   0.636 -0.273  1.75   0.560  0.273
#> 6 Franc…      10       5         0         2   0.667 -0.333 NA     NA      1    
#> # ℹ 12 more rows
#> # A tibble: 14 × 10
#>   names TieSame TieDiff NoTieSame NoTieDiff PctSame    EI  Odds LogOdds YulesQ
#>   <chr>   <dbl>   <dbl>     <dbl>     <dbl>   <dbl> <dbl> <dbl>   <dbl>  <dbl>
#> 1 E1          0       0         0         0      NA    NA    NA      NA     NA
#> 2 E2          0       0         0         0      NA    NA    NA      NA     NA
#> 3 E3          0       0         0         0      NA    NA    NA      NA     NA
#> 4 E4          0       0         0         0      NA    NA    NA      NA     NA
#> 5 E5          0       0         0         0      NA    NA    NA      NA     NA
#> 6 E6          0       0         0         0      NA    NA    NA      NA     NA
#> # ℹ 8 more rows