Learn R Programming

multigraph (version 1.0)

frcd: Force Directed Layout

Description

A function to compute the graph coordinated system with a force directed layout algorithm.

Usage

frcd(net, seed = seed, maxiter, drp, scl, mov, ...)

Value

A data frame with a coordinated system with two columns representing the abscissa and the ordinate in a two-dimensional rectangular Cartesian coordinate system.

Arguments

net

Array representing network relations.

seed

(mandatory) Seed of initial layout (see details).

maxiter

(optional) Maximum number of iterations.

drp

(optional, for valued networks) Drop values less than specified.

scl

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

mov

(optional and experimental) Scalar (\(x\) and \(y\)) or vector (\(x\), \(y\)) to move graph coordinates.

...

Additional argument items.

Details

This function is meant as an internal routine for graph visualization with a force-directed layout procedure. However, it can be used to set the coordinate system with the coord option in functions multigraph and in bmgraph. In such case, the coordinate system of the graph starts with a random displacement of nodes where NULL in the seed argument implies an initial seed based on the computer clock watch, and the number of iterations in maxiter is \(60+n\).

References

Fruchterman, T.M.J., & Reingold, E.M. Graph drawing by force-directed placement. Software-Practice & Experience, 21(11), 1129-1164. 1991.

See Also

multigraph, bmgraph, 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 ) )

# Coordinates for the force directed layout with random start
coord <- frcd(arr, seed = NULL)

# Plot multigraph with forced directed coordinates
multigraph(arr, coord = coord)

Run the code above in your browser using DataLab