| project_bipartite | R Documentation |
Projects a two-mode (bipartite/incidence) network into a one-mode adjacency matrix. Row-mode projection yields a matrix of shared-column connections among row nodes; column-mode projection does the converse.
project_bipartite(x, mode = "rows", method = "sum", ...)
x |
An incidence matrix (rows = type 1 nodes, columns = type 2 nodes)
where non-zero entries indicate connections. Can also be a data.frame with
columns |
mode |
Character. |
method |
Character. Projection method:
|
... |
Additional arguments (currently unused). |
For the Newman projection, affiliations shared with only one node of the
focal type (d_k = 1) are skipped, since 1 / (d_k - 1) is
undefined. This follows the convention in Newman (2001).
A square adjacency matrix with row and column names preserved from the input. Diagonal is set to 0 (no self-loops).
Newman, M. E. J. (2001). Scientific collaboration networks. II. Shortest paths, weighted networks, and centrality. Physical Review E, 64(1), 016132.
is_bipartite, plot_heatmap
# Incidence matrix: 4 students x 3 courses
inc <- matrix(c(1, 1, 0,
1, 0, 1,
0, 1, 1,
1, 1, 1), 4, 3, byrow = TRUE)
rownames(inc) <- paste0("S", 1:4)
colnames(inc) <- paste0("C", 1:3)
# Student co-enrollment (weighted)
cograph::project_bipartite(inc, mode = "rows", method = "sum")
# Course overlap (Jaccard similarity)
cograph::project_bipartite(inc, mode = "columns", method = "jaccard")
# Newman's weighted projection
cograph::project_bipartite(inc, mode = "rows", method = "newman")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.