class2Graph            package:classGraph            R Documentation

_B_u_i_l_d _t_h_e _G_r_a_p_h _o_f _S_u_p_e_r _C_l_a_s_s_e_s _f_r_o_m _a_n _S_4 _C_l_a_s_s _D_e_f_i_n_i_t_i_o_n

_D_e_s_c_r_i_p_t_i_o_n:

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

_U_s_a_g_e:

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

_A_r_g_u_m_e_n_t_s:

   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.

_V_a_l_u_e:

     an R object inheriting from class 'graph'.

_A_u_t_h_o_r(_s):

     Robert Gentleman (original code) and Martin Maechler

_S_e_e _A_l_s_o:

     'classTree' which builds the graph of all _sub_classes.

_E_x_a_m_p_l_e_s:

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

