SCM

SCM Repository

[matrix] View of /pkg/tests/graph.R
ViewVC logotype

View of /pkg/tests/graph.R

Parent Directory Parent Directory | Revision Log Revision Log


Revision 909 - (download) (annotate)
Fri Sep 9 08:12:31 2005 UTC (13 years, 11 months ago) by maechler
File size: 806 byte(s)
if(require(graph))  around everything
if(require(graph)) {

    library(Matrix)
    if(FALSE)## for ease of developer:
        library(Matrix, lib="/u/maechler/R/Pkgs/Matrix.Rcheck")

    example("graphNEL-class", echo = FALSE)
    nodes(gR)

    ## 1) undirected
    sm.g <- as(gR, "sparseMatrix")
    str(sm.g)## 'dsT' - fine; even has Dimnames!
    validObject(sm.g)
    sm.g # should show the Dimnames - at least row ones

    ## 2) directed
    gU <- gR; edgemode(gU) <- "directed"
    sgU <- as(gU, "sparseMatrix")
    str(sgU)## 'dgT' with dimnames
    validObject(sgU)
    sgU # should now show the Dimnames!

    ### Reverse :  sparseMatrix -> graph
    if(FALSE) { ## not yet (FIXME!)
        gmg  <- as(sm.g, "graph")
        gmg2 <- as(sm.g, "graphNEL")
        gmgU <- as(sgU, "graph")
        gmgU <- as(sgU, "graphNEL")
    }

}

root@r-forge.r-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business Powered By FusionForge