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)

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.

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, mean, tie-strength weighted mean, minimum, maximum, range, and standard deviation of the attribute across each node's alters.

The weighted mean 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. Isolates have no alters and so take NA.

Any tie counts as a tie here, whatever its sign. 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                1196                    194   447      1334
#> 2 Doug White                  132                     75   250       664
#> 3 Ev Rogers                    10                      0     0         4
#> 4 Richard Alba                120                     17    25       169
#> 5 Phipps Arabie                27                     12    24        92
#> 6 Carol Barner-Barry           42                     14    28       155
#> # ℹ 26 more rows
node_x_alters(ison_networkers, "Citations")
#> # A tibble: 32 × 8
#>   names                Sum  Mean Weighted   Min   Max Range    SD
#>   <chr>              <dbl> <dbl>    <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 Lin Freeman          714  23.0    12.7      0   170   170 32.8 
#> 2 Doug White           672  24      18.1      0   170   170 34.1 
#> 3 Ev Rogers             31  10.3     9.71     3    19    16  8.08
#> 4 Richard Alba         281  15.6    15.9      0    56    56 15.9 
#> 5 Phipps Arabie        597  21.3    19.6      0   170   170 32.7 
#> 6 Carol Barner-Barry   273  18.2    14.6      0    56    56 15.4 
#> # ℹ 26 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