A function to create and manipulate bipartite graphs for affiliation or two-mode network networks.
bmgraph(net, layout = c("bip", "bip3", "bip3e", "bipc", "CA", "force", "rand", "stress",
"circ", "conc", "circ2"), scope, coord, alpha = c(1, 1, 1), showLbs, showAtts,
att = NULL, lbat = "1", main = NULL, cex.main, col.main, font.main, directed,
valued, collRecip, cex, pos, lwd, lty, col, ecol, vcol, vcol0, bg, asp,
seed = NULL, maxiter = 100, bwd, clu, pch, rot, mirrorX, mirrorY, mirrorV,
mirrorH, hds, vedist, jitter, sort, add, adc, perm, ffamily, fstyle, fsize, fcol,
mar, scl, new, ...)A plot of the two-mode network as a bipartite graph or multigraph with a projection.
A data frame or array representing an affiliation network incidence matrix.
Visualization layout:
bip Bipartite graph (default)
bip3 Bipartite graph with three columns
bip3e Bipartite graph with three columns for events
bipc “Clustered” bipartite graph
force Apply force-directed algorithm
rand Random
circ Circular
stress Apply stress-majorization algorithm
CA Apply correspondence analysis
circ2 Two semi-circles.
(optional) List with scope of graph, edge and vertex characteristics.
(optional, ignores layout) Two-column data frame of vertex coordinates in graph.
Vector with the alpha colour transparencies for (vertex, edge, bg).
(optional and logical) Show vertex labels in graph when available?
(optional and logical) Show vertex attribute labels in graph?
(optional) Vector or array representing vertex attributes.
(optional) Labels for vertex attributes.
(optional) Main title of the plot graph.
Font size of title in plot graph.
Font colour of title in plot graph.
Font family of title in plot graph.
(optional and logical) Is the bipartite graph directed?
Is the bipartite graph valued?
(optional and logical) Collapse reciprocated edges in (undirected) graph?
(optional) Vertex size.
(optional) Position of labels from vertex:
1: Below
2: Left
3: Above
4: Right
0: Centre
(optional, ignored for valued) Width of edges.
(optional) Shape of edges.
(optional) Alias for vcol.
(optional) Colour of edges.
(optional) Colour of vertices.
(optional, only for pch=21 through pch=25) Colour of vertices contour.
(optional) Background colour of plot graph.
(optional, asp=NA cover whole canvas) Aspect ratio of plot.
(optional, for force, stress and rand) Random seed number for initial coordinates of vertices.
(optional, for force, stress and rand) Maximum number of iterations in layout algorithm.
(optional, default 1) Real number for width between bundle edges.
(optional) Clustering of vertices (see details).
(optional) Symbol(s) for vertices.
(optional) Clockwise rotation in degrees on graph.
(optional) Mirror by \(X\) axis.
(optional) Mirror by \(Y\) axis.
“Same as mirrorX”.
“Same as mirrorY”.
(optional, experimental) Head scale for arcs.
(optional, experimental) Vertex--edge distance.
(optional, in stress or CA) Amount of jitter to add on coordinates.
(optional and logical) Sort vertex labels?
(optional) Nodes to add nodes to network domain.
(optional) Nodes to add nodes to network co-domain.
(optional) List of vectors for permutation of network nodes in domain and codomain.
(optional) Font family of vertex labels in graph.
(optional) Font style of vertex labels in graph with options: bold, italic, bolditalic.
(optional) Font size of vertex labels in graph.
(optional) Font colour of text in graph vertices.
(optional) Plot margins.
(optional, experimental) Numerical scalar (\(x\) and \(y\)) or vector (\(x\), \(y\)) of graph scale.
(optional, logical) Plot new graph on canvas afterwards?
Additional argument items.
Bipartite graphs serve as visual aids for affiliation or two-mode networks. While affiliation networks are typically represented as data frames, they can also be visualized using three-dimensional arrays. In such case, each level corresponds to a specific type of connection, resulting in parallel edges within the bipartite graph. Additionally, a bipartite network can be generated using a force-directed algorithm to create a visual representation.
With bipartite graphs consisting of two sets of vertices, clustering information, such as vertex colours, can be stored in a list vclu with two vectors, one for each vertex set.
It is possible to group all members of a vertex set into a single class by setting the corresponding vector to NULL.
multigraph, frcd, stsm, conc
# Two binary relations among three elements
arr <- round( replace( array(runif(18), c(3,3,2)), array(runif(18),
c(3,3,2))>.5, 3 ) )
# Plot network as bipartite graph
bmgraph(arr)
# Apply force directed algorithm for plot
bmgraph(arr, layout = "force")
# Apply Correspondence Analysis
bmgraph(arr, layout = "CA", asp = NA)
Run the code above in your browser using DataLab