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.

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.

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

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    fromAiden fromBelinda fromCourtney fromDestiny fromEunice fromFrancis
#>   <chr>        <dbl>       <dbl>        <dbl>       <dbl>      <dbl>       <dbl>
#> 1 Aiden          0             0         0              0       0.3         0   
#> 2 Belinda        0             0         0              0       0           0   
#> 3 Courtney       0             0         0              0       0.15        0.75
#> 4 Destiny        0             0         0              0       0           0   
#> 5 Eunice         0.3           0         0.15           0       0           0.45
#> 6 Francis        0             0         0.6            0       0.75        0   
#> # ℹ 10 more rows
#> # ℹ 26 more variables: fromGabriel <dbl>, fromHunter <dbl>, fromInez <dbl>,
#> #   fromJonathan <dbl>, fromKristy <dbl>, fromLindsay <dbl>, fromMikayla <dbl>,
#> #   fromNicholas <dbl>, fromOlga <dbl>, fromPenny <dbl>, toAiden <dbl>,
#> #   toBelinda <dbl>, toCourtney <dbl>, toDestiny <dbl>, toEunice <dbl>,
#> #   toFrancis <dbl>, toGabriel <dbl>, toHunter <dbl>, toInez <dbl>,
#> #   toJonathan <dbl>, toKristy <dbl>, toLindsay <dbl>, toMikayla <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>