A function to create and manipulate multigraphs and valued multigraphs with different layout options
multigraph(net, layout = c("circ", "force", "stress", "conc", "rand"), scope,
directed=TRUE, loops, signed, valued, values, lbs, showLbs, att, lbat,
showAtts, main=NULL, cex.main, col.main, font.main, coord, collRecip, undRecip,
seed=NULL, maxiter=100, clu, cex, cex2, pch, lwd, lty, vcol, vcol0, col, ecol,
bwd, bwd2, pos, bg, bg2, asp, drp, add, swp, swp2, alpha=c(1, 1, 1, 1), rot,
mirrorX, mirrorY, mirrorD, mirrorL, mirrorV, mirrorH, scl, hds, vedist, mar,
ffamily, fstyle, fsize, fsize2, fcol, fcol2, lclu, sel, new, mai, lscl,
rm.isol, ...)
A plot of the network as a multigraph or a valued multigraph.
an array; usually with three dimensions of stacked matrices where the multiple relations are placed.
the visualization layout:
circ
circular
force
force-directed
stress
stress-majorization
conc
concentric
rand
random
(optional) the scope of the graph (see details)
(logical) whether or not the graph is directed or unidrected
(optional, logical, and experimental) plot graph loops?
(optional and logical) whether or not the graph is a signed structure
(optional and logical) whether the graph is depicyed as valued or not
(optional and logical) print the values of the bonds in edges?
(optional) the vertices labels
(optional and logical) whether or not show the vertex labels
(optional) a vector or an array representing the vertex attributes
(optional) the labels for the vertices' attributes
(optional and logical) whether or not show the vertex attribute labels
(optional) title of the plot
(optional) the size of the plot's title
(optional) the color of the plot's title
(optional) the font of the plot's title
(optional) data frame with the coordinates of the vertices. If coordinates are given then the layout
option is ignored
(optional and logical) whether or not collapse reciprocated edges in the unidrected graph
(optional and logical) whether or not plot reciprocated edges as undirected
(optional) the random seed number for the vertices' initial coordinates. Ignored for circ
and conc
(optional) the maximum number of iterations in layout algorithms. Only for force
, stress
, and rand
(optional) the clustering of the vertices (see details)
(optional) the size of the vertices
the size of the background for the values with the valued
option
(optional) the symbol representing the vertices
(optional) the width of the edges; ignored if valued
is set to TRUE
(optional) the shape of the edges
(optional) the color of the vertices
(optional) the color of the vertices' contour (only works for pch 21
through 25
(optional) alias for vcol
(optional) the color of the edges
(optional) the width of the bundle edges.
(optional) the width of the bundle loop edges.
(optional) the position of the vertices' labels (0
means ``in middle of vertex'')
(optional) the background color of the plot
(optional) the background color for values
(optional) the aspect ratio of the plot
(optional) for valued
networks, drop values less than the specified
(optional) nodes to add to the graph
(optional and logical) whether or not swap the bundle patterns
(optional and logical) whether or not swap reciprocals
vector (vertex, edge, bg
) with the alpha color transparecy
(optional) clockwise rotation of the graph in degrees
(optional) mirror of the \(X\) axis
(optional) mirror of the \(Y\) axis
(optional) mirror reflection across diagonal \(Y=X\)
(optional) mirror reflection across diagonal \(Y=-X\)
same as mirrorX
same as mirrorY
(optional and experimental) numerical scalar (\(x\) and \(y\)) or vector (\(x\), \(y\)) of the graph's scale
(optional and experimental) arcs' head scale
(optional and experimental) a real number with vertex - edge distance
(optional) the margins of the plot
the font family
the font style
the font size
the font size for values
the font color
the font color for values
(optional, vector) ``levels'' in clu
(see details)
(optional, vector) selection of node's labels to plot
(optional, logical) new graph on an existing plot?
(optional, vector) plot inner margins
(optional for valued graphs) loop scale
(optional) remove isolated vertices?
Additional argument items (see e.g. par
)
Antonio Rivero Ostoic
Multigraphs are graphs having parallel edges depicting different types of relations in a network. By default, a circular layout is applied where each type of tie has a distinctive shape and gray color scale. For better visualization, undirected multigraphs automatically collapse the reciprocal relations, and there is an argument to prevent this from happening. It is possible to combine the symbols and colors of vertices by assigning a class to each network member in the clustering option. Vertices can also have different sizes by specifying the argument with a vector with a length size similar to the network order.
Since this function can handle a large number of arguments, these can be stored as a list object that is passed through the scope
option. In this case, a vector made of lists and scalars or combinations of these is accepted for describing characteristics.
The bundle width specified by bwd
(and bwd2
for loops) ranges from 0
(edges collapsed) to the default 1
(depending on the vertices' size). For the valued
option, numbers higher than one are possible.
Use vedist
to adjust vertex--edge distance for large and dense networks.
In some cases, such as when working with dynamic networks, it is needed to specify the ordering of the ``levels'' of the clustering information given in clu
, and this is done in argument lclu
.
When using new
for plotting the graph with a background image, the previous plot(s), however, can require having an equivalent command to graphics::plot.new()
(cf. e.g. sdam::plot.map()
function).
bmgraph
, ccgraph
, frcd
, stsm
, conc
## Create the data: 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 the multigraph of this network
multigraph(arr)
## Now with a force directed algorithm
multigraph(arr, layout = "force")
## As weighted graph
multigraph(arr, weighted = TRUE)
## As signed graph
multigraph(arr, signed = TRUE)
## With loops and a costumized vertex size
multigraph(arr, cex = 3, loops = TRUE)
Run the code above in your browser using DataLab