I have a shapefile with some polygons and I'd like to create a graph that assigns vertices to polygons and creates edges between vertices if the corresponding polygons share a border. Since I'm using networkx
, a Python graph library, I was thinking of using GeoPandas to convert from the shapefile to a nx graph. Does anyone have any idea how to do this?
(networkx has a built-in read_shp
method, but I don't think that's what I want; I'm pretty sure (but not confident) that that translates points to vertices and lines to edges, not polygons and borders.)