These functions include ways to take a census of the positions of nodes in a network. These include a triad census based on the triad profile of nodes, but also a tie census based on the particular tie partners of nodes. Included also are group census functions for summarising the profiles of clusters of nodes in a network.

#' @export node_igraph_census <- function(object, normalized = FALSE) out <- igraph::motifs(as_igraph(object), 4) if(is_labelled(object)) rownames(out) <- node_names(object) colnames(out) <- c("co-K4", "co-diamond", "co-C4", "co-paw", "co-claw", "P4", "claw", "paw", "C4", "diamond", "K4") make_node_motif(out, object)

node_tie_census(object)

node_triad_census(object)

node_quad_census(object)

node_path_census(object)

Arguments

object

An object of a migraph-consistent class:

  • matrix (adjacency or incidence) from {base} R

  • edgelist, a data frame from {base} R or tibble from {tibble}

  • igraph, from the {igraph} package

  • network, from the {network} package

  • tbl_graph, from the {tidygraph} package

Details

The quad census uses the {oaqc} package to do the heavy lifting of counting the number of each orbits. See vignette('oaqc'). However, our function relabels some of the motifs to avoid conflicts and improve some consistency with other census-labelling practices. The letter-number pairing of these labels indicate the number and configuration of ties. For now, we offer a rough translation:

migraphOrtmann and Brandes
E4co-K4
I40, I41co-diamond
H4co-C4
L42, L41, L40co-paw
D42, D40co-claw
U42, U41P4
Y43, Y41claw
P43, P42, P41paw
04C4
Z42, Z43diamond
X4K4

See also this list of graph classes.

Functions

  • node_tie_census(): Returns a census of the ties in a network. For directed networks, out-ties and in-ties are bound together.

  • node_triad_census(): Returns a census of the triad configurations nodes are embedded in.

  • node_quad_census(): Returns a census of nodes' positions in motifs of four nodes.

  • node_path_census(): Returns the shortest path lengths of each node to every other node in the network.

References

Davis, James A., and Samuel Leinhardt. 1967. “The Structure of Positive Interpersonal Relations in Small Groups.” 55.

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 .

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

Examples

task_eg <- to_named(to_uniplex(ison_algebra, "task_tie"))
(tie_cen <- node_tie_census(task_eg))
#> # A tibble: 16 × 33
#>    names fromK…¹ fromL…² fromW…³ fromH…⁴ fromM…⁵ fromA…⁶ fromH…⁷ fromP…⁸ fromJ…⁹
#>    <chr>   <dbl>   <dbl>   <dbl>   <dbl>   <dbl>   <dbl>   <dbl>   <dbl>   <dbl>
#>  1 Kris…       0       1       0       0       1       1       0       0       1
#>  2 Lori        0       0       1       0       0       0       1       1       0
#>  3 Walt…       0       1       0       0       1       1       1       1       1
#>  4 Holly       0       0       0       0       0       0       0       0       0
#>  5 Mess…       1       0       1       0       0       1       0       1       0
#>  6 Aman…       0       0       1       0       1       0       0       1       0
#>  7 Hunt…       0       1       1       0       0       1       0       1       0
#>  8 Payt…       1       1       1       0       1       1       1       0       0
#>  9 Josi…       1       0       0       0       0       0       0       0       0
#> 10 Muri…       1       0       1       1       1       1       0       0       1
#> 11 Thom…       1       0       1       0       1       1       0       1       0
#> 12 Rosa        1       1       0       0       0       1       0       0       1
#> 13 Fred…       1       1       0       0       1       0       1       1       0
#> 14 Finn        0       1       1       0       0       1       1       1       0
#> 15 Pearl       1       1       1       0       1       0       1       1       1
#> 16 Mary        1       1       1       1       1       1       1       1       1
#> # … with 23 more variables: fromMuriel <dbl>, fromThomas <dbl>, fromRosa <dbl>,
#> #   fromFrederick <dbl>, fromFinn <dbl>, fromPearl <dbl>, fromMary <dbl>,
#> #   toKristen <dbl>, toLori <dbl>, toWalter <dbl>, toHolly <dbl>,
#> #   toMessiah <dbl>, toAmanda <dbl>, toHunter <dbl>, toPayton <dbl>,
#> #   toJosiah <dbl>, toMuriel <dbl>, toThomas <dbl>, toRosa <dbl>,
#> #   toFrederick <dbl>, toFinn <dbl>, toPearl <dbl>, toMary <dbl>, and
#> #   abbreviated variable names ¹​fromKristen, ²​fromLori, ³​fromWalter, …
(triad_cen <- node_triad_census(task_eg))
#> # A tibble: 16 × 17
#>    names  X003  X012  X102 X021D X021U X021C X111D X111U X030T X030C  X201 X120D
#>    <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#>  1 Kris…     6    12    32     0     1     0     7     3     0     0     8     1
#>  2 Lori     15    12    42     0     0     0     0     5     0     0     4     1
#>  3 Walt…    20     5    37     0     0     0     3     3     0     0    12     0
#>  4 Holly   102     0     3     0     0     0     0     0     0     0     0     0
#>  5 Mess…    15     5    41     0     0     0     2     1     0     0    13     0
#>  6 Aman…    20     5    41     0     0     0     3     2     0     0    11     0
#>  7 Hunt…    28     0    51     0     0     0     0     2     0     0     6     0
#>  8 Payt…    18     0    42     0     0     0     2     1     0     0    18     0
#>  9 Josi…    86     2    17     0     0     0     0     0     0     0     0     0
#> 10 Muri…    25     6    35     0     0     0     3     3     0     0    15     0
#> 11 Thom…    65     4    36     0     0     0     0     0     0     0     0     0
#> 12 Rosa     72     3    30     0     0     0     0     0     0     0     0     0
#> 13 Fred…    76     3    26     0     0     0     0     0     0     0     0     0
#> 14 Finn     56     2    47     0     0     0     0     0     0     0     0     0
#> 15 Pearl    58     5    42     0     0     0     0     0     0     0     0     0
#> 16 Mary      0     0     0     0     0     0     0     0     0     0    44     0
#> # … with 4 more variables: X120U <dbl>, X120C <dbl>, X210 <dbl>, X300 <dbl>
node_quad_census(ison_southern_women)
#> # A tibble: 32 × 13
#>    names    E4   I41   I40    H4   L42   L41   L40   U42   U41   Y43   Y41   X04
#>    <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#>  1 EVEL…  1402  1046   474   202   397   692   148   200    78    56   190    75
#>  2 LAURA  1539   986   579   202   323   659   182   134    85    35   168    68
#>  3 THER…  1499   975   434   147   364   784    91   217    77    56   225    91
#>  4 BREN…  1559   968   562   198   320   682   179   134    82    35   170    71
#>  5 CHAR…  1945   763   972   171   117   419   359    30    89     4    70    21
#>  6 FRAN…  2063   652   944   126   102   502   269    36   102     4   130    30
#>  7 ELEA…  2122   598   930    98    93   546   224    42   114     4   156    33
#>  8 PEARL  2313   439  1089    65    42   448   252    28   112     1   154    17
#>  9 RUTH   2180   549   918    73    80   577   178    56   123     4   190    32
#> 10 VERNE  2166   561   920    82    83   567   190    53   118     4   184    32
#> # … with 22 more rows
node_path_census(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
#> 7 Carol     3     2     2     3     3     1     0     1
#> 8 Tina      4     3     3     4     4     2     1     0
node_path_census(ison_southern_women)
#> # A tibble: 32 × 33
#>    names   EVELYN LAURA THERESA BRENDA CHARL…¹ 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 THERESA      2     2       0      2       2       2       2     2     2     2
#>  4 BRENDA       2     2       2      0       2       2       2     2     2     2
#>  5 CHARLO…      2     2       2      2       0       2       2     4     2     2
#>  6 FRANCES      2     2       2      2       2       0       2     2     2     2
#>  7 ELEANOR      2     2       2      2       2       2       0     2     2     2
#>  8 PEARL        2     2       2      2       4       2       2     0     2     2
#>  9 RUTH         2     2       2      2       2       2       2     2     0     2
#> 10 VERNE        2     2       2      2       2       2       2     2     2     0
#> # … with 22 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>, and abbreviated variable name ¹​CHARLOTTE