# Compute the bounds of Moran's I given spatial neighborhood graph

Source:`R/spatial-misc.R`

`moranBounds.Rd`

Values Moran's I can take depends on the spatial neighborhood graph. The
bounds of Moran's I given the graph, C, are given by the minimum and maximum
eigenvalues of the double centered -- i.e. subtracting column means and row
means -- adjacency matrix \((I - \mathbb{11}^T/n)C(I - \mathbb{11}^T/n)\), where \(\mathbb 1\) is a vector of all 1's.
This implementation follows the implementation in `adespatial`

and uses
the `RSpectra`

package to more quickly find only the minimum and maximum
eigenvalues without performing unnecessary work to find the full spectrum as
done in base R's `eigen`

.

## Note

After double centering, the adjacency matrix is no longer sparse, so this function can take up a lot of memory for larger datasets.

## References

de Jong, P., Sprenger, C., & van Veen, F. (1984). On extreme values of Moran's I and Geary's C. Geographical Analysis, 16(1), 17-24.

## Examples

```
# example code
library(SFEData)
sfe <- McKellarMuscleData("small")
#> see ?SFEData and browseVignettes('SFEData') for documentation
#> loading from cache
g <- findVisiumGraph(sfe)
moranBounds(g)
#> Imin Imax
#> -0.5825787 0.9725069
```