################################################### ### chunk number 1: exampleGraph1 ################################################### #line 51 "vignettes/graph/inst/doc/graphAttributes.Rnw" library("graph") mat <- matrix(c(0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0), byrow=TRUE, ncol=4) rownames(mat) <- letters[1:4] colnames(mat) <- letters[1:4] ################################################### ### chunk number 2: exampleGraph2 ################################################### #line 61 "vignettes/graph/inst/doc/graphAttributes.Rnw" g1 <- new("graphAM", adjMat=mat) ################################################### ### chunk number 3: foo ################################################### #line 65 "vignettes/graph/inst/doc/graphAttributes.Rnw" if (require("Rgraphviz")) { gn = as(g1, "graphNEL") plot(gn, nodeAttrs=makeNodeAttrs(gn, shape="circle", fillcolor="orange")) } else { plot(1, 1, main="Rgraphviz required for this plot") } ################################################### ### chunk number 4: edgeDataDefaults1 ################################################### #line 83 "vignettes/graph/inst/doc/graphAttributes.Rnw" edgeDataDefaults(g1) ################################################### ### chunk number 5: edgeDataDefaults2 ################################################### #line 91 "vignettes/graph/inst/doc/graphAttributes.Rnw" edgeDataDefaults(g1, "weight") <- 1 edgeDataDefaults(g1, "code") <- "plain" edgeDataDefaults(g1) ################################################### ### chunk number 6: edgeDataDefaults3 ################################################### #line 100 "vignettes/graph/inst/doc/graphAttributes.Rnw" edgeDataDefaults(g1, "weight") ################################################### ### chunk number 7: edgeData1 ################################################### #line 111 "vignettes/graph/inst/doc/graphAttributes.Rnw" edgeData(g1, from="a", to="d", attr="weight") edgeData(g1, from="a", attr="weight") edgeData(g1, to="a", attr="weight") allAttrsAllEdges <- edgeData(g1) weightAttrAllEdges <- edgeData(g1, attr="weight") ################################################### ### chunk number 8: edgeData2 ################################################### #line 127 "vignettes/graph/inst/doc/graphAttributes.Rnw" edgeData(g1, from="a", to="d", attr="weight") <- 2 edgeData(g1, from="a", attr="code") <- "fancy" edgeData(g1, from="a", attr="weight") edgeData(g1, from="a", attr="code") ################################################### ### chunk number 9: edgeData3 ################################################### #line 136 "vignettes/graph/inst/doc/graphAttributes.Rnw" f <- c("a", "b") t <- c("c", "c") edgeData(g1, from=f, to=t, attr="weight") <- 10 edgeData(g1, from=f, to=t, attr="weight") ################################################### ### chunk number 10: edgeData4 ################################################### #line 146 "vignettes/graph/inst/doc/graphAttributes.Rnw" edgeData(g1, from=f, to=t, attr="weight") <- c(11, 22) edgeData(g1, from=f, to=t, attr="weight") ################################################### ### chunk number 11: edgeData5 ################################################### #line 154 "vignettes/graph/inst/doc/graphAttributes.Rnw" edgeData(g1, from="a", to="d", attr="code") <- list(1:10) edgeData(g1, from=f, to=t, attr="weight") <- mapply(c, f, t, "e", SIMPLIFY=FALSE) edgeData(g1, from="a", to="d", attr="code") edgeData(g1, from=f, to=t, attr="weight") ################################################### ### chunk number 12: defaultNodeData1 ################################################### #line 170 "vignettes/graph/inst/doc/graphAttributes.Rnw" nodeDataDefaults(g1) nodeDataDefaults(g1, attr="weight") <- 1 nodeDataDefaults(g1, attr="type") <- "vital" nodeDataDefaults(g1) nodeDataDefaults(g1, "weight") ################################################### ### chunk number 13: nodeData1 ################################################### #line 189 "vignettes/graph/inst/doc/graphAttributes.Rnw" nodeData(g1, n="a") nodeData(g1, n="a", attr="weight") <- 100 nodeData(g1, n=c("a", "b"), attr="weight") nodeData(g1, n=c("a", "b"), attr="weight") <- 500 nodeData(g1, n=c("a", "b"), attr="weight") nodeData(g1, n=c("a", "b"), attr="weight") <- c(11, 22) nodeData(g1, n=c("a", "b"), attr="weight") ################################################### ### chunk number 14: other ################################################### #line 199 "vignettes/graph/inst/doc/graphAttributes.Rnw" ## We need to reconcile this #g2 <- as(g1, "graphNEL") #edgeWeights(g2)