classGraph (version 0.7-5)

class2Graph: Build the Graph of Super Classes from an S4 Class Definition

Description

From an S4 class definition class, computes the graph of all super classes, i.e., of all classes that class extends.

Usage

class2Graph(class, fullNames = TRUE, simpleOnly = FALSE,
            bottomUp = FALSE, package = class@package)

Value

an R object inheriting from class graph.

Arguments

class

class name

fullNames

logical indicating if full name should be applied....

simpleOnly

logical, simply passed to getAllSuperClasses(..).

bottomUp

logical indicating the direction of the graph.

package

package where the super classes should be gotten from.

Author

Robert Gentleman (original code) and Martin Maechler

See Also

classTree which builds the graph of all subclasses.

Examples

Run this code
require("graph")
cg <- class2Graph("graphNEL") # simple :  graphNEL |-> graph
plot(cg)

if(require("Matrix")) {
   cg2 <- class2Graph("dgCMatrix")
   as(cg2, "sparseMatrix")
   plot(cg2)
   ## alternative: don't show the initial "Matrix:"
   cg2. <- class2Graph("dgCMatrix", fullNames=FALSE)
   plot(cg2.)
   ## 'simpleOnly' does not change anything here :
   stopifnot(identical(cg2.,
          class2Graph("dgCMatrix", fullNames=FALSE, simpleOnly = TRUE)))


   ## very simple, since "sparseMatrix" only extends "Matrix" :
   cg3 <- class2Graph("sparseMatrix")
   plot(cg3)
}

Run the code above in your browser using DataCamp Workspace