Ragraph-class {Rgraphviz} | 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.

### 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.
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

### 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)

[Package Rgraphviz version 1.12.3 Index]