Learn R Programming

multigraph (version 0.91)

multigraph: Multigraphs and weighted multigraphs

Description

A function to create and manipulate multigraphs and weighted multigraphs with different layout options

Usage

multigraph(net, layout = c("circ", "force", "stress", "conc", "rand"), scope, 
           directed = TRUE, main = NULL, lbs, seed = NULL, maxiter = 100, 
           alpha = c(1, 1, 1), collRecip, showLbs, showAtts, cex.main, 
           weighted, weights, coord, clu, cex, lwd, pch, lty, bwd, fcol, att, 
           bg, mar, pos, asp, ecol, vcol, vcol0, cex2, fsize2, fcol2, hds, vedist, 
           rot, mirrorX, mirrorY, col, lbat, drp, loops, swp, swp2, signed, scl, 
           add, mirrorD, mirrorL, opt, mirrorV, mirrorH, ffamily, fstyle, fsize, ...)

Arguments

net

an array; usually with three dimensions of stacked matrices where the multiple relations are placed.

layout

the visualization layout:

circ circular

force force-directed

stress stress-majorization

conc concentric

rand random

scope

(optional) the scope of the graph (see details)

directed

(logical) whether or not the graph is directed or unidrected

main

(optional) title of the plot

lbs

(optional) the vertex labels

seed

(optional) the random seed number for the vertices' initial coordinates. Ignored for circ and conc

maxiter

(optional) the maximum number of iterations in layout algorithms. Only for force, stress, and rand

alpha

vector (vertex, edge, bg) with the alpha color transparecy

collRecip

(optional and logical) whether or not collapse reciprocated edges in the unidrected graph

showLbs

(optional and logical) whether or not show the vertex labels

showAtts

(optional and logical) whether or not show the vertex attribute labels

cex.main

(optional) the size of the plot's title

weighted

(optional and logical) whether or not the graph is weighted or dichotomous

weights

(optional and logical) whether or not print the weights of the bonds

coord

(optional) data frame with the coordinates of the vertices. If coordinates are given then the layout option is ignored

clu

(optional) the clustering of the vertices (see details)

cex

(optional) the size of the vertices

lwd

(optional) the width of the edges. Ignored if weighted is set to TRUE

pch

(optional) the symbol representing the vertices

lty

(optional) the shape of the edges

bwd

(optional) the width of the bundle edges. Ranges from 0 (edges collapsed) to the default 1 (depending on the vertices' size). For weighted a value greater than one is possible

fcol

the font color

att

(optional) a vector or an array representing the vertex attributes

bg

(optional) the background color of the plot

mar

(optional) the margins of the plot

pos

(optional) the position of the vertices' labels (0 means ``in the middle of the vertex'')

asp

(optional) the aspect ratio of the plot

ecol

(optional) the color of the edges

vcol

(optional) the color of the vertices

vcol0

(optional) the color of the vertices' contour (only works for pch 21 through 25

cex2

the size of the background for the weights

fsize2

the font size of the weights

fcol2

the font color of the weights

hds

(optional and experimental) arcs' head scale

vedist

(optional and experimental) a real number with vertex - edge distance

rot

(optional) clockwise rotation of the graph in degrees

mirrorX

(optional) mirror of the X axis

mirrorY

(optional) mirror of the Y axis

col

(optional) alias for vcol

lbat

(optional) the labels for the vertices' attributes

drp

(optional) for weighted networks, drop values less than specified

loops

(optional, logical, and experimental) plot graph loops?

swp

(optional and logical) whether or not swap the bundle patterns

swp2

(optional and logical) whether or not swap reciprocals

signed

(optional and logical) whether or not the graph is a signed structure

scl

(optional and experimental) numerical scalar (x and y) or vector (x, y) of the graph's scale

add

(optional) nodes to add to the graph

mirrorD

(optional) mirror reflection across diagonal Y=X

mirrorL

(optional) mirror reflection across diagonal Y=-X

opt

(optional and experimental) optimize the plot margins

mirrorV

same as mirrorX

mirrorH

same as mirrorY

ffamily

the font family

fstyle

the font style

fsize

the font size

Additional argument items (see e.g. par)

Value

A plot of the network as a multigraph or a weighted multigraph.

Details

Multigraph are graph 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 a better visualization, undirected multigraphs automatically collapse the reciprocal ties, and there as an argument to prevent this to happen. It is possible to combine the symbols and color 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 are accepted.

See Also

bmgraph, ccgraph, frcd, stsm, conc

Examples

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