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.

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

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.

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.

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 .

Examples

task_eg <- to_named(to_uniplex(ison_algebra, "tasks"))
(tie_cen <- node_x_tie(task_eg))
#> # A tibble: 16 × 33
#>   names   fromAllison fromBrett fromCiara fromDoreen fromErika fromFrank
#>   <chr>         <dbl>     <dbl>     <dbl>      <dbl>     <dbl>     <dbl>
#> 1 Allison         0           0      0             0      0.3       0   
#> 2 Brett           0           0      0             0      0         0   
#> 3 Ciara           0           0      0             0      0.15      0.75
#> 4 Doreen          0           0      0             0      0         0   
#> 5 Erika           0.3         0      0.15          0      0         0.45
#> 6 Frank           0           0      0.6           0      0.75      0   
#> # ℹ 10 more rows
#> # ℹ 26 more variables: fromGeneva <dbl>, fromHudson <dbl>, fromIsabel <dbl>,
#> #   fromJermaine <dbl>, fromKenneth <dbl>, fromLucy <dbl>, fromMabel <dbl>,
#> #   fromNicholas <dbl>, fromOrville <dbl>, fromParis <dbl>, toAllison <dbl>,
#> #   toBrett <dbl>, toCiara <dbl>, toDoreen <dbl>, toErika <dbl>, toFrank <dbl>,
#> #   toGeneva <dbl>, toHudson <dbl>, toIsabel <dbl>, toJermaine <dbl>,
#> #   toKenneth <dbl>, toLucy <dbl>, toMabel <dbl>, toNicholas <dbl>, …
node_x_path(ison_adolescents)
#> # A tibble: 8 × 9
#>   names Betty   Sue Alice  Jane  Dale   Pam Carol  Tina
#>   <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 Betty     0     1     2     3     2     2     3     4
#> 2 Sue       1     0     1     2     1     1     2     3
#> 3 Alice     2     1     0     1     1     1     2     3
#> 4 Jane      3     2     1     0     1     2     3     4
#> 5 Dale      2     1     1     1     0     2     3     4
#> 6 Pam       2     1     1     2     2     0     1     2
#> # ℹ 2 more rows
node_x_path(ison_southern_women)
#> # A tibble: 18 × 33
#>   names  Evelyn Laura Theresa Brenda Charlotte Frances Eleanor Pearl  Ruth Verne
#>   <chr>   <dbl> <dbl>   <dbl>  <dbl>     <dbl>   <dbl>   <dbl> <dbl> <dbl> <dbl>
#> 1 Evelyn      0     2       2      2         2       2       2     2     2     2
#> 2 Laura       2     0       2      2         2       2       2     2     2     2
#> 3 There…      2     2       0      2         2       2       2     2     2     2
#> 4 Brenda      2     2       2      0         2       2       2     2     2     2
#> 5 Charl…      2     2       2      2         0       2       2     4     2     2
#> 6 Franc…      2     2       2      2         2       0       2     2     2     2
#> # ℹ 12 more rows
#> # ℹ 22 more variables: Myra <dbl>, Katherine <dbl>, Sylvia <dbl>, Nora <dbl>,
#> #   Helen <dbl>, Dorothy <dbl>, Olivia <dbl>, Flora <dbl>, E1 <dbl>, E2 <dbl>,
#> #   E3 <dbl>, E4 <dbl>, E5 <dbl>, E6 <dbl>, E7 <dbl>, E8 <dbl>, E9 <dbl>,
#> #   E10 <dbl>, E11 <dbl>, E12 <dbl>, E13 <dbl>, E14 <dbl>
#> # A tibble: 14 × 33
#>   names Evelyn Laura Theresa Brenda Charlotte Frances Eleanor Pearl  Ruth Verne
#>   <chr>  <dbl> <dbl>   <dbl>  <dbl>     <dbl>   <dbl>   <dbl> <dbl> <dbl> <dbl>
#> 1 E1         1     1       3      1         3       3       3     3     3     3
#> 2 E2         1     1       1      3         3       3       3     3     3     3
#> 3 E3         1     1       1      1         1       1       3     3     3     3
#> 4 E4         1     3       1      1         1       3       3     3     3     3
#> 5 E5         1     1       1      1         1       1       1     3     1     3
#> 6 E6         1     1       1      1         3       1       1     1     3     3
#> # ℹ 8 more rows
#> # ℹ 22 more variables: Myra <dbl>, Katherine <dbl>, Sylvia <dbl>, Nora <dbl>,
#> #   Helen <dbl>, Dorothy <dbl>, Olivia <dbl>, Flora <dbl>, E1 <dbl>, E2 <dbl>,
#> #   E3 <dbl>, E4 <dbl>, E5 <dbl>, E6 <dbl>, E7 <dbl>, E8 <dbl>, E9 <dbl>,
#> #   E10 <dbl>, E11 <dbl>, E12 <dbl>, E13 <dbl>, E14 <dbl>