Last data update: 2014.03.03

R: A function to obtain a Ragraph object
agopenSimpleR Documentation

A function to obtain a Ragraph object

Description

This function will read in a graphNEL object and create a Ragraph object, returning it for use in other functions. The graph represented by the Ragraph can be laidout in various formats.

Usage

agopenSimple(graph, name, kind = NULL, edgeMode=edgemode(graph),
       subGList=list(), recipEdges=c("combined", "distinct"))

Arguments

graph

An object of class graphNEL

name

The name of the Ragraph

kind

The type of graph

subGList

A list describing subgraphs for the graph parameter

edgeMode

Whether the graph is directed or undirected

recipEdges

How to handle reciprocated edges, defaults to combined, TODO: use this

Details

graph is from the package graph-class.

The edgeMode argument specifies whether the graph is to be laid out with directed or undirected edges. This parameter defaults to the edgemode of the graph argument.

The kind parameter works as follows:

NULL:

Determine the direction of the graph from the graph object. This is the default and the recommended method.

AGRAPH:

An undirected graph

AGDIGRAPH:

A directed graph

AGRAPHSTRICT:

A strict undirected graph

AGDIGRAPHSTRICT:

A strict directed graph

Strict graphs do not allow self arcs or multi-edges.

The subGList parameter is a list describing any subgraphs, where each element represents a subgraph and is itself a list with up to three elements. The first element, graph is required and contains the actual graph object for the subgraph. The second element, cluster is a logical value indicating if this is a cluster or a subgraph (a value of TRUE indicates a cluster, which is also the default value if this element is not specified). In Graphviz, subgraphs are more of an organizational mechanism, whereas clusters are laid out separately from the main graph and then later inserted. The last element of the list, attrs is used if there are any attributes for this subgraph. This is a named vector where the names are the attributes and the elements are the values for those attributes.

The recipEdges argument can be used to specify how to handle reciprocal edges. The default value, combined will combine any reciprocated edges into a single edge (and if the graph is directed, will by default place an arrowhead on both ends of the edge), while the other option is distinct which will draw to separate edges. Note that in the case of an undirected graph, every edge of a graphNEL is going to be reciprocal due to implementation issues.

Value

An object of class Ragraph

Author(s)

Li Long <li.long@isb-sib.ch>

References

http://www.research.att.com/sw/tools/graphviz/

See Also

graphLayout, Ragraph, plot

Examples

set.seed(123)
V <- letters[1:10]
M <- 1:4
g1 <- randomGraph(V, M, .2)
z <- agopenSimple(g1,name="foo")
if(graphvizVersion() >= "2.10") {
  ## This example will only run with Graphviz >= 2.10
  plot(z, "twopi")
}

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(Rgraphviz)
Loading required package: graph
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, cbind, colnames, do.call, duplicated, eval, evalq,
    get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply,
    match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank,
    rbind, rownames, sapply, setdiff, sort, table, tapply, union,
    unique, unsplit

Loading required package: grid
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/Rgraphviz/agopenSimple.Rd_%03d_medium.png", width=480, height=480)
> ### Name: agopenSimple
> ### Title: A function to obtain a Ragraph object
> ### Aliases: agopenSimple
> ### Keywords: graphs
> 
> ### ** Examples
> 
> set.seed(123)
> V <- letters[1:10]
> M <- 1:4
> g1 <- randomGraph(V, M, .2)
> z <- agopenSimple(g1,name="foo")
> if(graphvizVersion() >= "2.10") {
+   ## This example will only run with Graphviz >= 2.10
+   plot(z, "twopi")
+ }
Warning message:
In if (graphvizVersion() >= "2.10") { :
  the condition has length > 1 and only the first element will be used
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>