Question: I have a Java project with SVN version control system. My IDE is eclipse. Iniitally when I open the project, I edited something. Since this is team project. Someone else commit his own .class and .project file into svn. When I pointed out, he removed .class and .project in some particular sub projects. Anyway, I have .class and .project in all sub projects. Now I want to a clean environment, I want to delete all .class and .project files. Are there some script available in this forum?

Answer: 
Just incase this is still an open question for the OP or someone else stumbles here.

```
import pysal as ps 
w = ps.queen_from_shapefile('shapefile.shp')

```

<http://pysal.readthedocs.io/en/latest/users/tutorials/weights.html#pysal-spatial-weight-types>
I am not familiar with the specific data formats being used, but regardless, think the following idea would work.

In Python you can make sets out of tuples of numbers, i.e. `(x,y)` and `(x1,y1,x2,y2)`, so it should be possible to make a set representing all the points or edges in a given polygon. Afterwards you would be able use very fast set intersection operations to find all 1st order neighbors.

You might be able to speed the process up using some sort of trivial rejection test to avoid further processing of polygons which could not possibly be a neighbor -- perhaps using your polygons' centroids idea.

Does this explanation make sense?