Description Usage Arguments Value Author(s) See Also Examples
Construct a neighbour-matrix from a graph
and disaply it
1 2 |
graph |
An |
reordering |
A possible reordering. Typical the one obtained from a |
factor |
A scaling of the |
max.dim |
Maximum dimension of the |
... |
Additional arguments to |
inla.graph2matrix
returns a sparse symmetric matrix where the non-zero pattern is defined by the graph
.
The inla.spy
function, plots a binary image of a graph
. The reordering
argument
is typically the reordering used by inla
, found in result$misc$reordering
.
Havard Rue hrue@math.ntnu.no
inla.read.graph
, inla.qreordering
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | n = 50
Q = matrix(0, n, n)
idx = sample(1:n, 2*n, replace=TRUE)
Q[idx, idx] = 1
diag(Q) = 1
g = inla.read.graph(Q)
QQ = inla.graph2matrix(g)
inla.spy(QQ)
print(all.equal(as.matrix(Q), as.matrix(QQ)))
g.file = inla.write.graph(g)
inla.dev.new()
inla.spy(g.file)
inla.spy(g.file, reordering = inla.qreordering(g))
g = inla.read.graph(g.file)
inla.dev.new()
inla.spy(g)
inla.dev.new()
inla.spy(3, 1, "1 2 2 1 1 3 0")
inla.dev.new()
inla.spy(3, 1, "1 2 2 1 1 3 0", reordering = 3:1)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.