Learn R Programming

multigraph (version 1.0)

bmgraph: Bipartite Graphs for Affiliation Networks

Description

A function to create and manipulate bipartite graphs for affiliation or two-mode network networks.

Usage

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

Value

A plot of the two-mode network as a bipartite graph or multigraph with a projection.

Arguments

net

A data frame or array representing an affiliation network incidence matrix.

layout

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.

scope

(optional) List with scope of graph, edge and vertex characteristics.

coord

(optional, ignores layout) Two-column data frame of vertex coordinates in graph.

alpha

Vector with the alpha colour transparencies for (vertex, edge, bg).

showLbs

(optional and logical) Show vertex labels in graph when available?

showAtts

(optional and logical) Show vertex attribute labels in graph?

att

(optional) Vector or array representing vertex attributes.

lbat

(optional) Labels for vertex attributes.

main

(optional) Main title of the plot graph.

cex.main

Font size of title in plot graph.

col.main

Font colour of title in plot graph.

font.main

Font family of title in plot graph.

directed

(optional and logical) Is the bipartite graph directed?

valued

Is the bipartite graph valued?

collRecip

(optional and logical) Collapse reciprocated edges in (undirected) graph?

cex

(optional) Vertex size.

pos

(optional) Position of labels from vertex:

  • 1: Below

  • 2: Left

  • 3: Above

  • 4: Right

  • 0: Centre

lwd

(optional, ignored for valued) Width of edges.

lty

(optional) Shape of edges.

col

(optional) Alias for vcol.

ecol

(optional) Colour of edges.

vcol

(optional) Colour of vertices.

vcol0

(optional, only for pch=21 through pch=25) Colour of vertices contour.

bg

(optional) Background colour of plot graph.

asp

(optional, asp=NA cover whole canvas) Aspect ratio of plot.

seed

(optional, for force, stress and rand) Random seed number for initial coordinates of vertices.

maxiter

(optional, for force, stress and rand) Maximum number of iterations in layout algorithm.

bwd

(optional, default 1) Real number for width between bundle edges.

clu

(optional) Clustering of vertices (see details).

pch

(optional) Symbol(s) for vertices.

rot

(optional) Clockwise rotation in degrees on graph.

mirrorX

(optional) Mirror by \(X\) axis.

mirrorY

(optional) Mirror by \(Y\) axis.

mirrorV

“Same as mirrorX”.

mirrorH

“Same as mirrorY”.

hds

(optional, experimental) Head scale for arcs.

vedist

(optional, experimental) Vertex--edge distance.

jitter

(optional, in stress or CA) Amount of jitter to add on coordinates.

sort

(optional and logical) Sort vertex labels?

add

(optional) Nodes to add nodes to network domain.

adc

(optional) Nodes to add nodes to network co-domain.

perm

(optional) List of vectors for permutation of network nodes in domain and codomain.

ffamily

(optional) Font family of vertex labels in graph.

fstyle

(optional) Font style of vertex labels in graph with options: bold, italic, bolditalic.

fsize

(optional) Font size of vertex labels in graph.

fcol

(optional) Font colour of text in graph vertices.

mar

(optional) Plot margins.

scl

(optional, experimental) Numerical scalar (\(x\) and \(y\)) or vector (\(x\), \(y\)) of graph scale.

new

(optional, logical) Plot new graph on canvas afterwards?

...

Additional argument items.

Details

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.

See Also

multigraph, frcd, stsm, conc

Examples

Run this code
# 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