Examples on how to use NetworkX and GeoPandas in Python.
Used in an undergraduate Operations Research course at Oklahoma State University (IEM 4013). Video lectures available on YouTube.
NX1_Basics.ipynb shows how to:
- create a graph object
- add vertices
- add edges
- query the neighbors of a node
NX2_Attributes_and_Algorithms.ipynb shows how to:
- add node attributes
- add edge attributes
- add graph attributes
- check if a graph is connected
- check if a subgraph is connected
- compute unweighted (i.e., hop-based) distances
- compute weighted distances
NX3_Reading_Graphs.ipynb shows how to:
- read a graph from file (if stored as a list of edges)
- draw a graph
NX4_GeoPandas.ipynb shows how to:
- read a graph from a .json file (using the GerryChain reader)
- query the name of a node
- query the population of a node
- read a shapefile with GeoPandas
- draw a single district with GeoPandas