R: Class "Ragraph": A class to handle libgraph representations
Ragraph-class
R Documentation
Class "Ragraph": A class to handle libgraph representations
Description
Class Ragraph is used to handle libgraph
representations of R graph objects.
Objects from the Class
Objects can be created by calls to the function agopen.
Slots
agraph:
Object of class "externalptr": A C
based structure containing the libgraph information
laidout:
Object of class "logical": Whether or
not this graph has been laid out or not.
layoutType:
Object of class "character": The
layout method used for this object
edgemode:
Object of class "character": The
edgemode for this graph - “directed” or
“undirected”
AgNode:
Object of class "list": A list of
AgNode objects.
AgEdge:
Object of class "list": A list of
AgEdge objects.
boundBox:
Object of class "boundBox": Defines
the bounding box of the plot.
bg:
Object of class "character": The background
color.
fg:
Object of class "character": The foreground
color.
Methods
show
signature(object = "Ragraph"): A brief summary of
the contents
agraph
signature(object = "Ragraph"): Returns the
external libgraph pointer
laidout
signature(object = "Ragraph"): Returns the
laidout slot
boundBox
signature(object = "Ragraph"): Returns the
bounding box.
AgEdge
signature(object = "Ragraph"): Returns the edge
list.
AgNode
signature(object = "Ragraph"): Returns the node
list.
edgemode
signature(object = "Ragraph"): Retrieves the
edgemode of this object.
layoutType
signature(object = "Ragraph"): Retrieves the
method used for the layout of this graph.
edgeNames
signature(object = "Ragraph"): Returns a
vector of the names of the edges in this graph.
graphDataDefaults
signature(self= "Ragraph"):
Gets default attributes of the given graph.
graphDataDefaults<-
signature(self= "Ragraph", attr="vector", value="vector"):
Sets default attributes of the given graph.
graphData
signature(self= "Ragraph", attr="vector"):
Gets attributes of the given graph.
graphData<-
signature(self= "Ragraph", attr="vector", value="vector"):
Sets attributes of the given graph.
clusterData
signature(self= "Ragraph", cluster="numeric", attr="vector"):
Gets attributes of a cluster for the given graph.
clusterData<-
signature(self= "Ragraph", cluster="numeric", attr="vector", value="vector"):
Sets attributes of a cluster for the given graph.
edgeDataDefaults
signature(self= "Ragraph",attr="missing"):
Gets default attributes of the given edge.
edgeDataDefaults<-
signature(self= "Ragraph", attr="vector", value="vector"):
Sets default attributes of the given edge.
edgeData
signature(self= "Ragraph", from="vector", to="vector", attr="vector"):
Gets attributes of the given edge.
edgeData<-
signature(self= "Ragraph", from="vector", to="vector", attr="vector", value="vector"):
Sets attributes of the given edge.
nodeDataDefaults
signature(self= "Ragraph",attr="missing"):
Gets default attributes of the given node.
nodeDataDefaults<-
signature(self= "Ragraph", attr="vector", value="vector"):
Sets default attributes of the given node.
nodeData
signature(self= "Ragraph", n="vector", attr="vector"):
Gets attributes of the given node.
nodeData<-
signature(self= "Ragraph", n="vector", attr="vector", value="vector"):
Sets attributes of the given node.
getNodeXY
signature(object = "Ragraph"): Returns a two
element list, the first element contains a numerical vector with
the 'x' positions of every node in this graph, and the second
element contains a numerical vector with the 'y' positions for
every node in the graph.
getNodeHeight
signature(object = "Ragraph"): Returns a
vector with the heights of every node in the graph
getNodeLW
signature(object = "Ragraph"): Returns a
vector with the left width of every node in the graph.
getNodeRW
signature(object = "Ragraph"): Returns a
vector with the right width of every node in the graph.
Author(s)
Jeff Gentry and Li Long <li.long@isb-sib.ch>
See Also
agopen
Examples
set.seed(123)
V <- letters[1:10]
M <- 1:4
g1 <- randomGraph(V, M, .2)
z <- agopen(g1,"foo")
z
## The various methods in action
## These methods are all used to obtain positional information about nodes
getNodeXY(z)
getNodeHeight(z)
getNodeLW(z)
getNodeRW(z)
## Retrieve information about the edges in the graph
edgeNames(z)
edgemode(z)
## These get information about the layout
laidout(z)
layoutType(z)
boundBox(z)
## Used to retrieve the entire list of edges or nodes
AgEdge(z)
AgNode(z)
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/Ragraph-class.Rd_%03d_medium.png", width=480, height=480)
> ### Name: Ragraph-class
> ### Title: Class "Ragraph": A class to handle libgraph representations
> ### Aliases: Ragraph-class Ragraph agraph laidout layoutType edgemode
> ### boundBox show,Ragraph-method edgeNames,Ragraph-method
> ### graphDataDefaults,Ragraph-method
> ### graphDataDefaults<-,Ragraph,vector,vector-method
> ### graphData,Ragraph,vector-method
> ### graphData<-,Ragraph,vector,vector-method
> ### clusterData,Ragraph,numeric,vector-method
> ### clusterData<-,Ragraph,numeric,vector,vector-method
> ### edgeDataDefaults,Ragraph,missing-method
> ### edgeDataDefaults<-,Ragraph,vector,vector-method
> ### edgeData,Ragraph,vector,vector,vector-method
> ### edgeData<-,Ragraph,vector,vector,vector,vector-method
> ### nodeDataDefaults,Ragraph,missing-method
> ### nodeDataDefaults<-,Ragraph,vector,vector-method
> ### nodeData,Ragraph,vector,vector-method
> ### nodeData<-,Ragraph,vector,vector,vector-method AgEdge,Ragraph-method
> ### AgEdge<-,Ragraph-method agraph,Ragraph-method boundBox,Ragraph-method
> ### laidout,Ragraph-method layoutType,Ragraph-method
> ### edgemode,Ragraph-method AgNode,Ragraph-method AgNode<-,Ragraph-method
> ### getNodeLW,Ragraph-method getNodeRW,Ragraph-method
> ### getNodeHeight,Ragraph-method getNodeXY,Ragraph-method getNodeXY
> ### getNodeNames getNodeLabels
> ### Keywords: classes
>
> ### ** Examples
>
> set.seed(123)
> V <- letters[1:10]
> M <- 1:4
> g1 <- randomGraph(V, M, .2)
> z <- agopen(g1,"foo")
> z
[1] "A graph with 10 nodes."
>
> ## The various methods in action
>
> ## These methods are all used to obtain positional information about nodes
> getNodeXY(z)
$x
[1] 147 62 377 147 147 62 259 195 370 482
$y
[1] 477 387 117 297 207 117 477 27 477 477
> getNodeHeight(z)
[1] 54 54 54 54 54 54 54 54 54 54
> getNodeLW(z)
[1] 27 27 27 27 27 27 27 27 27 27
> getNodeRW(z)
[1] 27 27 27 27 27 27 27 27 27 27
>
> ## Retrieve information about the edges in the graph
> edgeNames(z)
[1] "a~b" "a~d" "a~e" "a~f" "a~h" "b~d" "b~e" "b~f" "b~h" "c~h" "d~e" "d~f"
[13] "d~h" "e~f" "e~h" "f~h"
> edgemode(z)
[1] "undirected"
>
> ## These get information about the layout
> laidout(z)
[1] TRUE
> layoutType(z)
[1] "dot"
> boundBox(z)
An object of class "boundingBox"
Slot "botLeft":
x: 0, y: 0
Slot "upRight":
x: 524, y: 504
>
> ## Used to retrieve the entire list of edges or nodes
> AgEdge(z)
[[1]]
An edge between b and a with 1 BezierCurve objects:
129,456 114,442 95,421 81,407
[[2]]
An edge between d and a with 1 BezierCurve objects:
147,449 147,415 147,357 147,324
[[3]]
An edge between e and a with 2 BezierCurve objects:
158,452 174,413 201,334 183,270
183,270 179,255 171,240 163,229
[[4]]
An edge between f and a with 2 BezierCurve objects:
121,470 92,463 47,447 26,414
26,414 -27,325 25,194 50,141
[[5]]
An edge between h and a with 3 BezierCurve objects:
170,462 211,435 291,374 291,298
291,298 291,298 291,298 291,206
291,206 291,141 242,77 214,46
[[6]]
An edge between d and b with 1 BezierCurve objects:
81,366 95,352 115,331 129,317
[[7]]
An edge between e and b with 2 BezierCurve objects:
71,361 81,337 96,300 111,270
111,270 118,256 126,241 133,230
[[8]]
An edge between f and b with 1 BezierCurve objects:
62,359 62,308 62,195 62,144
[[9]]
An edge between h and b with 2 BezierCurve objects:
50,362 23,309 -32,175 26,90
26,90 58,43 129,31 168,28
[[10]]
An edge between h and c with 1 BezierCurve objects:
353,104 318,87 254,56 219,39
[[11]]
An edge between e and d with 1 BezierCurve objects:
147,269 147,258 147,245 147,234
[[12]]
An edge between f and d with 2 BezierCurve objects:
133,273 126,262 118,247 111,234
111,234 96,203 81,166 71,142
[[13]]
An edge between h and d with 2 BezierCurve objects:
163,274 170,263 179,248 183,234
183,234 202,171 200,93 197,54
[[14]]
An edge between f and e with 1 BezierCurve objects:
129,186 114,172 95,151 81,137
[[15]]
An edge between h and e with 1 BezierCurve objects:
154,180 163,146 179,86 188,53
[[16]]
An edge between h and f with 1 BezierCurve objects:
84,101 109,85 148,59 173,42
> AgNode(z)
[[1]]
An object of class "AgNode"
Slot "center":
x: 147, y: 477
Slot "name":
[1] "a"
Slot "txtLabel":
An object of class "AgTextLabel"
Slot "labelText":
[1] "a"
Slot "labelLoc":
x: 0, y: 0
Slot "labelJust":
[1] "n"
Slot "labelWidth":
[1] 6
Slot "labelColor":
[1] "black"
Slot "labelFontsize":
[1] 14
Slot "height":
[1] 54
Slot "rWidth":
[1] 27
Slot "lWidth":
[1] 27
Slot "color":
[1] "black"
Slot "fillcolor":
[1] "transparent"
Slot "shape":
[1] "circle"
Slot "style":
[1] ""
[[2]]
An object of class "AgNode"
Slot "center":
x: 62, y: 387
Slot "name":
[1] "b"
Slot "txtLabel":
An object of class "AgTextLabel"
Slot "labelText":
[1] "b"
Slot "labelLoc":
x: 0, y: 0
Slot "labelJust":
[1] "n"
Slot "labelWidth":
[1] 7
Slot "labelColor":
[1] "black"
Slot "labelFontsize":
[1] 14
Slot "height":
[1] 54
Slot "rWidth":
[1] 27
Slot "lWidth":
[1] 27
Slot "color":
[1] "black"
Slot "fillcolor":
[1] "transparent"
Slot "shape":
[1] "circle"
Slot "style":
[1] ""
[[3]]
An object of class "AgNode"
Slot "center":
x: 377, y: 117
Slot "name":
[1] "c"
Slot "txtLabel":
An object of class "AgTextLabel"
Slot "labelText":
[1] "c"
Slot "labelLoc":
x: 0, y: 0
Slot "labelJust":
[1] "n"
Slot "labelWidth":
[1] 6
Slot "labelColor":
[1] "black"
Slot "labelFontsize":
[1] 14
Slot "height":
[1] 54
Slot "rWidth":
[1] 27
Slot "lWidth":
[1] 27
Slot "color":
[1] "black"
Slot "fillcolor":
[1] "transparent"
Slot "shape":
[1] "circle"
Slot "style":
[1] ""
[[4]]
An object of class "AgNode"
Slot "center":
x: 147, y: 297
Slot "name":
[1] "d"
Slot "txtLabel":
An object of class "AgTextLabel"
Slot "labelText":
[1] "d"
Slot "labelLoc":
x: 0, y: 0
Slot "labelJust":
[1] "n"
Slot "labelWidth":
[1] 7
Slot "labelColor":
[1] "black"
Slot "labelFontsize":
[1] 14
Slot "height":
[1] 54
Slot "rWidth":
[1] 27
Slot "lWidth":
[1] 27
Slot "color":
[1] "black"
Slot "fillcolor":
[1] "transparent"
Slot "shape":
[1] "circle"
Slot "style":
[1] ""
[[5]]
An object of class "AgNode"
Slot "center":
x: 147, y: 207
Slot "name":
[1] "e"
Slot "txtLabel":
An object of class "AgTextLabel"
Slot "labelText":
[1] "e"
Slot "labelLoc":
x: 0, y: 0
Slot "labelJust":
[1] "n"
Slot "labelWidth":
[1] 6
Slot "labelColor":
[1] "black"
Slot "labelFontsize":
[1] 14
Slot "height":
[1] 54
Slot "rWidth":
[1] 27
Slot "lWidth":
[1] 27
Slot "color":
[1] "black"
Slot "fillcolor":
[1] "transparent"
Slot "shape":
[1] "circle"
Slot "style":
[1] ""
[[6]]
An object of class "AgNode"
Slot "center":
x: 62, y: 117
Slot "name":
[1] "f"
Slot "txtLabel":
An object of class "AgTextLabel"
Slot "labelText":
[1] "f"
Slot "labelLoc":
x: 0, y: 0
Slot "labelJust":
[1] "n"
Slot "labelWidth":
[1] 4
Slot "labelColor":
[1] "black"
Slot "labelFontsize":
[1] 14
Slot "height":
[1] 54
Slot "rWidth":
[1] 27
Slot "lWidth":
[1] 27
Slot "color":
[1] "black"
Slot "fillcolor":
[1] "transparent"
Slot "shape":
[1] "circle"
Slot "style":
[1] ""
[[7]]
An object of class "AgNode"
Slot "center":
x: 259, y: 477
Slot "name":
[1] "g"
Slot "txtLabel":
An object of class "AgTextLabel"
Slot "labelText":
[1] "g"
Slot "labelLoc":
x: 0, y: 0
Slot "labelJust":
[1] "n"
Slot "labelWidth":
[1] 7
Slot "labelColor":
[1] "black"
Slot "labelFontsize":
[1] 14
Slot "height":
[1] 54
Slot "rWidth":
[1] 27
Slot "lWidth":
[1] 27
Slot "color":
[1] "black"
Slot "fillcolor":
[1] "transparent"
Slot "shape":
[1] "circle"
Slot "style":
[1] ""
[[8]]
An object of class "AgNode"
Slot "center":
x: 195, y: 27
Slot "name":
[1] "h"
Slot "txtLabel":
An object of class "AgTextLabel"
Slot "labelText":
[1] "h"
Slot "labelLoc":
x: 0, y: 0
Slot "labelJust":
[1] "n"
Slot "labelWidth":
[1] 7
Slot "labelColor":
[1] "black"
Slot "labelFontsize":
[1] 14
Slot "height":
[1] 54
Slot "rWidth":
[1] 27
Slot "lWidth":
[1] 27
Slot "color":
[1] "black"
Slot "fillcolor":
[1] "transparent"
Slot "shape":
[1] "circle"
Slot "style":
[1] ""
[[9]]
An object of class "AgNode"
Slot "center":
x: 370, y: 477
Slot "name":
[1] "i"
Slot "txtLabel":
An object of class "AgTextLabel"
Slot "labelText":
[1] "i"
Slot "labelLoc":
x: 0, y: 0
Slot "labelJust":
[1] "n"
Slot "labelWidth":
[1] 3
Slot "labelColor":
[1] "black"
Slot "labelFontsize":
[1] 14
Slot "height":
[1] 54
Slot "rWidth":
[1] 27
Slot "lWidth":
[1] 27
Slot "color":
[1] "black"
Slot "fillcolor":
[1] "transparent"
Slot "shape":
[1] "circle"
Slot "style":
[1] ""
[[10]]
An object of class "AgNode"
Slot "center":
x: 482, y: 477
Slot "name":
[1] "j"
Slot "txtLabel":
An object of class "AgTextLabel"
Slot "labelText":
[1] "j"
Slot "labelLoc":
x: 0, y: 0
Slot "labelJust":
[1] "n"
Slot "labelWidth":
[1] 3
Slot "labelColor":
[1] "black"
Slot "labelFontsize":
[1] 14
Slot "height":
[1] 54
Slot "rWidth":
[1] 27
Slot "lWidth":
[1] 27
Slot "color":
[1] "black"
Slot "fillcolor":
[1] "transparent"
Slot "shape":
[1] "circle"
Slot "style":
[1] ""
>
>
>
>
>
> dev.off()
null device
1
>