I was missing the spam library.
I did some testing with m x m matrices (see below). Computing 'a' is the
villain. The computation time for 'a' is exponential in m. For a 100 by 100
matrix, the predicted time is about 20 seconds. Thus, 100,000 runs, would
take about 23 days.
library(igraph)
libr
I just updated spdep and I see that as.spam.listw works. Below is
sessionInfo
Furthermore, it may be straightforward to condense the adjacency
matrix *before* converting to graph which may help a little bit. You
can profile the code and see which part needs speeding up.
library(spdep)
lib
I have spdep 4.58. Perhaps it is deprecated in the new version. Try looking
for sparse matrix representation in the help files for spdep
Nikhil
On Mon, Jun 21, 2010 at 6:10 AM, Daniel Malter wrote:
>
> as.spam.listw is an unknown function. Is it in a different package?
>
> Daniel
>
> other att
as.spam.listw is an unknown function. Is it in a different package?
Daniel
other attached packages:
[1] spdep_0.5-11coda_0.13-5 deldir_0.0-12
maptools_0.7-34 foreign_0.8-38 nlme_3.1-96 MASS_7.3-3
[8] Matrix_0.999375-31 lattice_0.17-26 boot_1
Instead of nb2mat try
as.spam.listw(nb2listw(cell2nb(...)))
this will coerce the adjacency matrix into a sparse matrix representation
saving lot of memory.
Nikhil
On Sun, Jun 20, 2010 at 10:27 PM, Daniel Malter wrote:
>
> Hi, thanks much. This works in principle. The corrected code is below:
Hi, thanks much. This works in principle. The corrected code is below:
a <- nb2mat(cell2nb(nrow(x),ncol(x),torus=T), style="B")
g <- delete.vertices(graph.adjacency(a), which(x!=1)-1)
plot(g)
clusters(g)
the $no argument of the clusters(g) function is the sought after number.
However, the funct
I am sure this can be written in a much more elegant and faster code.
One way I can think of, is to modify cell2nb code and create a new
function that creates the neighbour lists of only cells that are not
0. These are best directed to R-sig-Geo list.
However, the following might work.
li
Hi all, I am sorry if this is a very basic quesion, but I have no experience
with analyzing spatial data and could not find the right function/package
quickly. Any hints would be much appreciated. I have a matrix of spatial
point patterns like the one below and want to find the number of independe
8 matches
Mail list logo