These functions offer tools for projecting manynet-consistent data:

  • to_mode1() projects a two-mode network to a one-mode network of the first node set's (e.g. rows) joint affiliations to nodes in the second node set (columns).

  • to_mode2() projects a two-mode network to a one-mode network of the second node set's (e.g. columns) joint affiliations to nodes in the first node set (rows).

  • to_ties() projects a network to one where the ties become nodes and incident nodes become their ties.

to_mode1(.data, similarity = c("count", "jaccard", "rand", "pearson", "yule"))

to_mode2(.data, similarity = c("count", "jaccard", "rand", "pearson", "yule"))

to_ties(.data)

Arguments

.data

An object of a {manynet}-consistent class:

  • adjacency or incidence matrix from {base} R

  • edgelist data.frame from {base} R or tbl/tbl_df from {tibble}

  • stocnet stocnet, from the {manynet} package

  • igraph igraph, from the {igraph} package

  • network network, from the {network} package

  • tidygraph tbl_graph, from the {tidygraph} package

similarity

Method for establishing ties, currently "count" (default), "jaccard", or "rand".

  • "count" calculates the number of coinciding ties, and can be interpreted as indicating the degree of opportunities between nodes.

  • "jaccard" uses this count as the numerator in a proportion, where the denominator consists of any cell where either node has a tie. It can be interpreted as opportunity weighted by participation.

  • "rand", or the Simple Matching Coefficient, is a proportion where the numerator consists of the count of cells where both nodes are present or both are absent, over all possible cells. It can be interpreted as the (weighted) degree of behavioral mirroring between two nodes.

  • "pearson" (Pearson's coefficient) and "yule" (Yule's Q) produce correlations for valued and binary data, respectively. Note that Yule's Q has a straightforward interpretation related to the odds ratio.

Value

A tidygraph object modified as explained in the function description, details, or section.

Details

Not all functions have methods available for all object classes. Below are the currently implemented S3 methods:

         data.frame default igraph matrix network tbl_graph
to_mode1          *       *      *      *       *         *
to_mode2          *       *      *      *       *         *
to_ties                   *      *

Comparison of two-mode projection methods

CategoryFeaturemanynet::to_mode1()/to_mode2()igraph::bipartite_projection()network/sna manual
InputDedicated functionyesyesno
Accepted input classesigraph, network, tidygraph, matrix, edgelistigraph onlyany (manual extraction)
Detects mode membership frommode node attributetype vertex attributebipartite network attr (positional)
ProjectionReturns both projections at onceno — one per callyes — list of twotwo manual calls
Projects mode 1 (actors)to_mode1()which = "true"A %*% t(A)
Projects mode 2 (events)to_mode2()which = "false"t(A) %*% A
WeightsRaw co-membership countsyesyes (multiplicity = TRUE)yes
Binary (unweighted) outputyesyes (multiplicity = FALSE)threshold manually
Jaccard normalisationyesnocode manually
Cosine normalisationyesnocode manually
AttributesRetains node attributesyesyesno — lost in matrix round-trip
Retains edge attributesweight onlyweight onlyno
Removes self-loops automaticallyyesyesdiag(P) <- 0 manually
OutputOutput class matches inputyesnono
Directed projection supportlimitedno — undirected onlyyes — asymmetric matrix
UsabilityLines of code (basic case)114–6
Lines of code (Jaccard weights)1~8 manual~8 manual
Pipe-friendlyyeswith wrappersno

Examples

to_mode1(ison_southern_women)
#> 
#> ── # Projection of Southern Women Data ─────────────────────────────────────────
#> # A labelled, weighted, undirected network of 18 womens and 139 co-social
#> events ties
#> 
#> ── Nodes 
#> # A tibble: 18 × 3
#>   name      Surname    Title
#>   <chr>     <chr>      <chr>
#> 1 Evelyn    Jefferson  Mrs  
#> 2 Laura     Mandeville Miss 
#> 3 Theresa   Anderson   Miss 
#> 4 Brenda    Rogers     Miss 
#> 5 Charlotte McDowd     Miss 
#> 6 Frances   Anderson   Miss 
#> # ℹ 12 more rows
#> 
#> ── Ties 
#> # A tibble: 139 × 3
#>    from    to weight
#>   <int> <int>  <dbl>
#> 1     1     2      6
#> 2     1     4      6
#> 3     1     3      7
#> 4     1     5      3
#> 5     1     6      4
#> 6     1     7      3
#> # ℹ 133 more rows
#> 
to_mode2(ison_southern_women)
#> ── # Projection of Southern Women Data ─────────────────────────────────────────
#> # A labelled, weighted, undirected network of 14 social events and 66 co-women
#> ties
#> 
#> ── Nodes 
#> # A tibble: 14 × 3
#>   name  Surname Title
#>   <chr> <chr>   <chr>
#> 1 E1    6/27    NA   
#> 2 E2    3/2     NA   
#> 3 E3    4/12    NA   
#> 4 E4    9/26    NA   
#> 5 E5    2/25    NA   
#> 6 E6    5/19    NA   
#> # ℹ 8 more rows
#> 
#> ── Ties 
#> # A tibble: 66 × 3
#>    from    to weight
#>   <int> <int>  <dbl>
#> 1     1     2      2
#> 2     1     3      3
#> 3     1     4      2
#> 4     1     5      3
#> 5     1     6      3
#> 6     1     8      3
#> # ℹ 60 more rows
#> 
to_ties(ison_adolescents)
#> IGRAPH 0ff62e7 UN-- 10 20 -- Line graph
#> + attr: name (g/c), name (v/c)
#> + edges from 0ff62e7 (vertex names):
#>  [1] Betty-Sue --Sue-Alice  Sue-Alice --Alice-Jane Betty-Sue --Sue-Dale  
#>  [4] Sue-Alice --Sue-Dale   Sue-Dale  --Alice-Dale Sue-Alice --Alice-Dale
#>  [7] Alice-Jane--Alice-Dale Sue-Dale  --Jane-Dale  Alice-Dale--Jane-Dale 
#> [10] Alice-Jane--Jane-Dale  Betty-Sue --Sue-Pam    Sue-Alice --Sue-Pam   
#> [13] Sue-Dale  --Sue-Pam    Sue-Pam   --Alice-Pam  Sue-Alice --Alice-Pam 
#> [16] Alice-Jane--Alice-Pam  Alice-Dale--Alice-Pam  Sue-Pam   --Pam-Carol 
#> [19] Alice-Pam --Pam-Carol  Pam-Carol --Carol-Tina