/usr/lib/R/site-library/graph/doc/graphAttributes.R is in r-bioc-graph 1.56.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | ### R code from vignette source 'graphAttributes.Rnw'
###################################################
### code chunk number 1: exampleGraph1
###################################################
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]
###################################################
### code chunk number 2: exampleGraph2
###################################################
g1 <- graphAM(adjMat=mat)
###################################################
### code chunk number 3: foo
###################################################
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")
}
###################################################
### code chunk number 4: edgeDataDefaults1
###################################################
edgeDataDefaults(g1)
###################################################
### code chunk number 5: edgeDataDefaults2
###################################################
edgeDataDefaults(g1, "weight") <- 1
edgeDataDefaults(g1, "code") <- "plain"
edgeDataDefaults(g1)
###################################################
### code chunk number 6: edgeDataDefaults3
###################################################
edgeDataDefaults(g1, "weight")
###################################################
### code chunk number 7: edgeData1
###################################################
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")
###################################################
### code chunk number 8: edgeData2
###################################################
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")
###################################################
### code chunk number 9: edgeData3
###################################################
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")
###################################################
### code chunk number 10: edgeData4
###################################################
edgeData(g1, from=f, to=t, attr="weight") <- c(11, 22)
edgeData(g1, from=f, to=t, attr="weight")
###################################################
### code chunk number 11: edgeData5
###################################################
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")
###################################################
### code chunk number 12: defaultNodeData1
###################################################
nodeDataDefaults(g1)
nodeDataDefaults(g1, attr="weight") <- 1
nodeDataDefaults(g1, attr="type") <- "vital"
nodeDataDefaults(g1)
nodeDataDefaults(g1, "weight")
###################################################
### code chunk number 13: nodeData1
###################################################
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")
###################################################
### code chunk number 14: other
###################################################
## We need to reconcile this
#g2 <- as(g1, "graphNEL")
#edgeWeights(g2)
|