SCM

SCM Repository

[matrix] Annotation of /branches/Matrix-mer2/tests/graph.R
ViewVC logotype

Annotation of /branches/Matrix-mer2/tests/graph.R

Parent Directory Parent Directory | Revision Log Revision Log


Revision 909 - (view) (download)
Original Path: pkg/tests/graph.R

1 : maechler 909 if(require(graph)) {
2 : maechler 886
3 : maechler 909 library(Matrix)
4 :     if(FALSE)## for ease of developer:
5 :     library(Matrix, lib="/u/maechler/R/Pkgs/Matrix.Rcheck")
6 :    
7 : maechler 886 example("graphNEL-class", echo = FALSE)
8 :     nodes(gR)
9 :    
10 :     ## 1) undirected
11 :     sm.g <- as(gR, "sparseMatrix")
12 :     str(sm.g)## 'dsT' - fine; even has Dimnames!
13 :     validObject(sm.g)
14 :     sm.g # should show the Dimnames - at least row ones
15 :    
16 :     ## 2) directed
17 :     gU <- gR; edgemode(gU) <- "directed"
18 :     sgU <- as(gU, "sparseMatrix")
19 :     str(sgU)## 'dgT' with dimnames
20 :     validObject(sgU)
21 :     sgU # should now show the Dimnames!
22 : maechler 907
23 :     ### Reverse : sparseMatrix -> graph
24 :     if(FALSE) { ## not yet (FIXME!)
25 :     gmg <- as(sm.g, "graph")
26 :     gmg2 <- as(sm.g, "graphNEL")
27 :     gmgU <- as(sgU, "graph")
28 :     gmgU <- as(sgU, "graphNEL")
29 :     }
30 : maechler 909
31 : maechler 886 }

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