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 <daniel@umd.edu> wrote:

>
> 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 function is very slow, and my machine runs out of memory (1G)
> for a 101 by 101 matrix.
>
> Daniel
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Spatial-number-of-independent-components-tp2262018p2262090.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]

