[1]:
%load_ext autoreload
%autoreload 2

from geosnap import DataStore
import pandarm as pdna
import geopandas as gpd

%load_ext watermark
%watermark -a 'eli knaap'  -d -u -iv
OMP: Info #276: omp_set_nested routine deprecated, please use omp_set_max_active_levels instead.
Author: eli knaap

Last updated: 2025-11-29

pandarm  : 0.0.2
geopandas: 1.1.1
geosnap  : 0.15.4.dev0+g08b0d60a8.d20251109

[2]:
datasets = DataStore()
[3]:
dc = datasets.tracts_2020()
dc = dc[dc.geoid.str.startswith("11")]
[4]:
dc.plot()
[4]:
<Axes: >
_images/example_notebook_3_1.png

collecting (and projecting) networks from OSM

[5]:
dcnet = pdna.Network.from_gdf(dc)
/Users/knaaptime/miniforge3/envs/geosnap/lib/python3.13/site-packages/pandarm/loaders/osm.py:11: UserWarning: Geometry is in a geographic CRS. Results from 'centroid' are likely incorrect. Use 'GeoSeries.to_crs()' to re-project geometries to a projected CRS before this operation.

  nodes["x"] = nodes.centroid.x
/Users/knaaptime/miniforge3/envs/geosnap/lib/python3.13/site-packages/pandarm/loaders/osm.py:12: UserWarning: Geometry is in a geographic CRS. Results from 'centroid' are likely incorrect. Use 'GeoSeries.to_crs()' to re-project geometries to a projected CRS before this operation.

  nodes["y"] = nodes.centroid.y
Generating contraction hierarchies with 16 threads.
Setting CH node vector of size 81541
Setting CH edge vector of size 250944
Range graph removed 253890 edges of 501888
. 10% . 20% . 30% . 40% . 50% . 60% . 70% . 80% . 90% . 100%
[6]:
dcnet.nodes_df.plot()
[6]:
<Axes: >
_images/example_notebook_6_1.png
[7]:
dcnet.nodes_df
[7]:
x y geometry
osmid
281072 -77.108256 38.935830 POINT (-77.10826 38.93583)
29918140 -77.047158 38.965092 POINT (-77.04716 38.96509)
30066940 -77.003440 38.884208 POINT (-77.00344 38.88421)
30066941 -77.003434 38.883326 POINT (-77.00343 38.88333)
30066942 -77.002146 38.883325 POINT (-77.00215 38.88332)
... ... ... ...
13290039693 -77.024983 38.906161 POINT (-77.02498 38.90616)
13291201708 -77.041490 38.923355 POINT (-77.04149 38.92335)
13291420690 -77.002776 38.904056 POINT (-77.00278 38.90406)
13293699829 -76.979227 38.865705 POINT (-76.97923 38.86571)
13293699832 -76.979710 38.865792 POINT (-76.97971 38.86579)

81541 rows × 3 columns

[8]:
dcnet.edges_df.plot()
[8]:
<Axes: >
_images/example_notebook_8_1.png
[9]:
dcnet = dcnet.to_crs(dc.estimate_utm_crs())
Generating contraction hierarchies with 16 threads.
Setting CH node vector of size 81541
Setting CH edge vector of size 250944
Range graph removed 253890 edges of 501888
. 10% . 20% . 30% . 40% . 50% . 60% . 70% . 80% . 90% . 100%
[10]:
dcnet.nodes_df.crs
[10]:
<Projected CRS: EPSG:32618>
Name: WGS 84 / UTM zone 18N
Axis Info [cartesian]:
- E[east]: Easting (metre)
- N[north]: Northing (metre)
Area of Use:
- name: Between 78°W and 72°W, northern hemisphere between equator and 84°N, onshore and offshore. Bahamas. Canada - Nunavut; Ontario; Quebec. Colombia. Cuba. Ecuador. Greenland. Haiti. Jamaica. Panama. Turks and Caicos Islands. United States (USA). Venezuela.
- bounds: (-78.0, 0.0, -72.0, 84.0)
Coordinate Operation:
- name: UTM zone 18N
- method: Transverse Mercator
Datum: World Geodetic System 1984 ensemble
- Ellipsoid: WGS 84
- Prime Meridian: Greenwich
[11]:
dcnet.edges_df.plot()
[11]:
<Axes: >
_images/example_notebook_11_1.png
[12]:
import osmnx as ox
[13]:
rest = ox.features_from_polygon(dc.union_all(), tags={"amenity": "restaurant"})
[14]:
rest.explore()
[14]:
Make this Notebook Trusted to load map: File -> Trust Notebook

distance to nearest POIs

[15]:
rest = rest.to_crs(dc.estimate_utm_crs())
[16]:
# the query returns mixed geometries; downcast polygons to points
rest["geometry"] = rest.geometry.centroid
[17]:
# attach restaurants to their nearest intersection
dcnet.set_pois(
    "restaurants",
    maxdist=2000,
    maxitems=20,
    x_col=rest.geometry.x.values,
    y_col=rest.geometry.y.values,
)
[18]:
# dataframe of distance from each node to 20 nearest restaurants up to 2km
nearest_rests = dcnet.nearest_pois(2000, "restaurants", num_pois=20)
[19]:
nearest_rests
[19]:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
osmid
281072 1722.780029 1751.822021 1795.729004 1938.045044 1961.211060 1999.130981 2000.000000 2000.000000 2000.000000 2000.000000 2000.000000 2000.000000 2000.000000 2000.000000 2000.000000 2000.000000 2000.000000 2000.000000 2000.000000 2000.000000
29918140 2000.000000 2000.000000 2000.000000 2000.000000 2000.000000 2000.000000 2000.000000 2000.000000 2000.000000 2000.000000 2000.000000 2000.000000 2000.000000 2000.000000 2000.000000 2000.000000 2000.000000 2000.000000 2000.000000 2000.000000
30066940 341.312988 341.312988 349.842987 349.842987 366.734985 366.734985 373.165009 373.165009 405.477997 418.924988 418.924988 462.247986 493.579987 514.273010 518.981995 535.489990 535.934998 535.934998 586.771973 605.823975
30066941 336.481995 336.481995 422.877991 422.877991 429.308014 429.308014 448.006989 448.006989 474.704987 474.704987 486.764008 503.627991 518.390991 529.742981 549.723022 571.655029 572.099976 572.099976 575.125000 641.989014
30066942 372.386993 372.386993 378.816986 378.816986 424.213989 424.213989 447.933014 447.933014 462.292999 462.292999 467.899994 499.231995 521.164001 521.335999 521.335999 524.633972 554.486023 590.773010 598.215027 605.546997
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
13290039693 32.282001 34.026001 62.501999 62.501999 96.134003 170.901001 170.901001 189.725006 229.513000 229.513000 267.623993 280.729004 282.670990 338.407013 390.432007 418.934998 423.709991 425.441010 439.636993 450.427002
13291201708 16.622999 36.609001 55.391998 113.616997 113.616997 130.654007 130.654007 169.727005 192.940994 214.862000 216.268005 216.268005 224.903000 224.903000 229.115997 229.115997 229.115997 245.440994 299.851013 299.851013
13291420690 5.134000 215.602997 237.639008 304.872986 551.218994 593.856018 610.981018 610.981018 613.841980 617.375000 631.005005 633.687012 633.687012 633.687012 635.859009 663.991028 664.778015 682.791992 702.434021 702.434021
13293699829 506.761993 694.593018 712.627014 790.791016 949.210022 1021.174011 1068.458984 1139.688965 1146.670044 1244.230957 1268.411987 1394.199951 1412.725952 1475.163940 2000.000000 2000.000000 2000.000000 2000.000000 2000.000000 2000.000000
13293699832 463.869995 651.700989 669.734985 747.898987 906.317993 978.281982 1025.567017 1096.796997 1103.777954 1225.520020 1264.847046 1432.271973 1433.342041 1437.092041 2000.000000 2000.000000 2000.000000 2000.000000 2000.000000 2000.000000

81541 rows × 20 columns

[20]:
# join to intersection geometries and visualize distance to nearest restaurant
dcnet.nodes_df.join(nearest_rests[1]).rename(columns={1: "dist"}).plot(
    "dist", scheme="quantiles", k=8, alpha=0.05
)
[20]:
<Axes: >
_images/example_notebook_21_1.png
[21]:
# distance to *5th nearest* restaurant, up to 2km
dcnet.nodes_df.join(nearest_rests[5]).rename(columns={5: "dist"}).plot(
    "dist", scheme="quantiles", k=8, alpha=0.05
)
/Users/knaaptime/miniforge3/envs/geosnap/lib/python3.13/site-packages/mapclassify/classifiers.py:1767: UserWarning: Not enough unique values in array to form 8 classes. Setting k to 7.
  self.bins = quantile(y, k=k)
[21]:
<Axes: >
_images/example_notebook_22_2.png

aggregations (network-based spatial lag)

[22]:
# create variable to aggregate. Since these are just binary locations set everything to 1
rest["count"] = 1
[23]:
# get the nearest intersection to each restaurant
rest_nodes = dcnet.get_node_ids(rest.geometry.x.values, rest.geometry.y.values)
[24]:
rest_nodes
[24]:
0        1624353716
1        7568297894
2        7568297894
3        2790488465
4        3519479345
           ...
1079    12564695820
1080    12564695820
1081    12564695820
1082    12564695820
1083    12542345597
Name: node_id, Length: 1084, dtype: int64
[25]:
# set the restaurants onto the network to be aggregated

dcnet.set(rest_nodes, rest["count"].values, name="restaurants")
[26]:
agg = dcnet.aggregate(2000, name="restaurants")
[27]:
agg
[27]:
osmid
281072           0.415641
29918140         0.000000
30066940        53.069074
30066941        53.408618
30066942        54.561703
                  ...
13290039693    143.102767
13291201708     79.105740
13291420690     40.590050
13293699829      6.587646
13293699832      6.781490
Length: 81541, dtype: float64
[28]:
dcnet.nodes_df.join(agg.rename("access")).plot("access", scheme="quantiles", k=8, alpha=0.05)
[28]:
<Axes: >
_images/example_notebook_30_1.png
[29]:
from lonboard import viz
from lonboard import basemap
from mapclassify.util import get_color_array

dc_nodes = dcnet.nodes_df.copy().assign(access=agg)
dc_nodes = dc_nodes.to_crs(dc.estimate_utm_crs())
dc_nodes["geometry"] = dc_nodes["geometry"].buffer(20)
colors = get_color_array(dc_nodes.access, scheme="fisher_jenks", k=8, cmap='inferno')
viz(
    dcnet.nodes_df.copy().assign(access=agg),
    scatterplot_kwargs=(
        dict(
            get_fill_color=colors,
            get_radius=36,
            opacity=0.7,
        )
    ),
    map_kwargs={'basemap_style':basemap.CartoBasemap.Positron, }
)
/Users/knaaptime/miniforge3/envs/geosnap/lib/python3.13/site-packages/lonboard/_geoarrow/ops/reproject.py:113: UserWarning: Input being reprojected to EPSG:4326 CRS.
Lonboard is only able to render data in EPSG:4326 projection.
  warnings.warn(
[29]:
[30]:
# visualize on tracts instead
dc = dc.to_crs(dc.estimate_utm_crs())  # make sure CRS matches network!
dc["nodes"] = dcnet.get_node_ids(dc.centroid.x, dc.centroid.y)
dc.merge(agg.rename("access"), left_on="nodes", right_index=True).plot(
    "access",
    scheme="quantiles",
    k=8,
)
[30]:
<Axes: >
_images/example_notebook_32_1.png
[31]:
dc.merge(agg.rename("access"), left_on="nodes", right_index=True).explore(
    "access",
    scheme="quantiles",
    k=8,
    alpha=0.5,
    tiles="cartodb positron",
    style_kwds={"weight": 0.5},
)
[31]:
Make this Notebook Trusted to load map: File -> Trust Notebook

isochrones (all destinations with X distance)

[32]:
irvine = ox.geocode_to_gdf("irvine, ca")
[33]:
irvine.explore()
[33]:
Make this Notebook Trusted to load map: File -> Trust Notebook
[34]:
libraries = ox.features_from_polygon(irvine.union_all(), tags={"amenity": "library"})
[35]:
libraries
[35]:
geometry amenity addr:city addr:country addr:housenumber addr:postcode addr:state addr:street alt_name building ... name:etymology ref short_name start_date description source type air_conditioning layer roof:shape
element id
node 13093009764 POINT (-117.80789 33.6633) library NaN NaN NaN NaN NaN NaN NaN NaN ... NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
relation 2275965 POLYGON ((-117.84636 33.64566, -117.84642 33.6... library Irvine NaN 520 92617 NaN Biological Court NaN yes ... NaN 520 SLIB NaN NaN NaN multipolygon yes 1 flat
way 101916822 POLYGON ((-117.77875 33.69948, -117.77862 33.6... library Irvine US 14361 92604 CA Yale Avenue Heritage Park Branch Library yes ... NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
171169252 POLYGON ((-117.84107 33.64751, -117.84079 33.6... library Irvine NaN 101 92617 NaN Gateway Court NaN yes ... Jack Langson 102 LLIB 1965 NaN NaN NaN NaN NaN NaN
207084927 POLYGON ((-117.77801 33.676, -117.77799 33.676... library Irvine NaN 5500 92618 CA Irvine Center Drive NaN university ... NaN NaN NaN NaN Library NaN NaN NaN NaN NaN
678012434 POLYGON ((-117.78539 33.73037, -117.7853 33.73... library Irvine US 13109 92602 CA Old Myford Road NaN yes ... NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
730434323 POLYGON ((-117.82071 33.6609, -117.82056 33.66... library Irvine NaN 4512 92612 CA Sandburg Way NaN yes ... NaN NaN NaN NaN NaN USGS Geonames NaN NaN NaN NaN

7 rows × 40 columns

[36]:
libraries["geometry"] = libraries.geometry.centroid
libraries.explore(color='red', style_kwds={'radius':10})
/var/folders/j8/5bgcw6hs7cqcbbz48d6bsftw0000gp/T/ipykernel_11447/3122961005.py:1: UserWarning: Geometry is in a geographic CRS. Results from 'centroid' are likely incorrect. Use 'GeoSeries.to_crs()' to re-project geometries to a projected CRS before this operation.

  libraries["geometry"] = libraries.geometry.centroid
[36]:
Make this Notebook Trusted to load map: File -> Trust Notebook
[37]:
sse = gpd.tools.geocode("UC Irvine school of social ecology")
[38]:
sse.explore(color='red', style_kwds={'radius':20})
[38]:
Make this Notebook Trusted to load map: File -> Trust Notebook
[39]:
irvine_net = pdna.Network.from_gdf(irvine)
/Users/knaaptime/miniforge3/envs/geosnap/lib/python3.13/site-packages/pandarm/loaders/osm.py:11: UserWarning: Geometry is in a geographic CRS. Results from 'centroid' are likely incorrect. Use 'GeoSeries.to_crs()' to re-project geometries to a projected CRS before this operation.

  nodes["x"] = nodes.centroid.x
/Users/knaaptime/miniforge3/envs/geosnap/lib/python3.13/site-packages/pandarm/loaders/osm.py:12: UserWarning: Geometry is in a geographic CRS. Results from 'centroid' are likely incorrect. Use 'GeoSeries.to_crs()' to re-project geometries to a projected CRS before this operation.

  nodes["y"] = nodes.centroid.y
Generating contraction hierarchies with 16 threads.
Setting CH node vector of size 43693
Setting CH edge vector of size 121440
Range graph removed 124598 edges of 242880
. 10% . 20% . 30% . 40% . 50% . 60% . 70% . 80% . 90% . 100%
[40]:
library_nodes = irvine_net.get_node_ids(libraries.geometry.x.values, libraries.geometry.y.values)
sse_node = irvine_net.get_node_ids(sse.geometry.x.values, sse.geometry.y.values)
[41]:
sse_node
[41]:
0    11329030680
Name: node_id, dtype: int64
[42]:
library_nodes
[42]:
0    13093009739
1    11103388255
2     4794678119
3     1955727850
4     8855712754
5     6348382796
6      122900129
Name: node_id, dtype: int64
[43]:
irvine_net.precompute(2000)
[44]:
# all intersections within 2km of irvine libraries
library_iso = irvine_net.nodes_in_range(library_nodes, 2000)
[45]:
# distance from each library (source) to all intersections (destination) and associated cost (length), up to 2km
library_iso
[45]:
source destination length
0 13093009739 13093009739 0.000000
1 13093009739 13093009738 7.721000
2 13093009739 13093009737 23.875999
3 13093009739 13093009741 30.834000
4 13093009739 13093009736 51.742001
... ... ... ...
15947 122900129 12383412781 1998.915039
15948 122900129 12375820859 1999.171021
15949 122900129 3744750544 1999.318970
15950 122900129 6788618364 1999.496948
15951 122900129 3744750557 1999.754028

15952 rows × 3 columns

intersections within 2km walk of UCI Langson Library

[46]:
m = irvine_net.nodes_df[
    irvine_net.nodes_df.index.isin(
        library_iso.query(f"source=={library_nodes[3]}").destination.values
    )
].explore(tiles="cartodb positron")
irvine_net.nodes_df.loc[[library_nodes[3]]].explore(m=m, color="red", style_kwds={"radius": 10})
[46]:
Make this Notebook Trusted to load map: File -> Trust Notebook

shortest paths

[47]:
single_path = irvine_net.shortest_path(sse_node[0], library_nodes[0])
[48]:
# list of nodes in path from SSE to first library
single_path
[48]:
array([11329030680,  8972594986,  8972595007,  8972595008, 11329030701,
        2523636562,  2523636559,  7041087144,  7041087148,  7041087147,
        7041087141, 12513737857,  9215126725,  9215110210, 11101164672,
         122633620,  9215126727,  9215110165,  2894898447,  2894898450,
        8921439881,  8921439880, 12377019591, 12377019589,  8921439876,
        8921439875, 12377019730,  8921439872,  9215110150,  9630951001,
        1832669174,  1836720579,  1836720582,  8921439815,   122779928,
         123058172, 11098805982,  1824581124,  1832669202,   122959101,
       11117464711,  2321316141,  2321316238,  2321316199,  2321316203,
       12372902839, 12372902837, 12384426815, 12384426818, 12384426846,
         123066066,   123066070,   122939960,   122746176,   123066075,
       12434680473, 12434680474, 12434680476,   123024133, 12434680475,
       12372902850,   122713342,   122623216,   122803528, 12384443880,
       12372831127,  2323342454,  2323342457,  9015654384, 12426331387,
       12426331391, 11611595661, 11611595403, 13093009736, 13093009737,
       13093009738, 13093009739])
[49]:
# reconstruct the path using geometries from edge_df
irvine_net.edges_df[
    (irvine_net.edges_df["from"].isin(single_path)) & (irvine_net.edges_df["to"].isin(single_path))
].explore(style_kwds={"weight": 5})
[49]:
Make this Notebook Trusted to load map: File -> Trust Notebook

(you can see the path reconstruction is imperfect in the map because some edges have the same from/to node pair; to do this correctly, we’d take only the shortest edge with the same from/to using a groupby or something)

[50]:
single_path_line = irvine_net.edges_df[
    (irvine_net.edges_df["from"].isin(single_path)) & (irvine_net.edges_df["to"].isin(single_path))
]
[51]:
single_path_line = single_path_line.groupby(["from", "to"])[["length"]].min().reset_index()
[52]:
single_path_line
[52]:
from to length
0 122623216 122713342 84.935547
1 122623216 122803528 67.042472
2 122633620 9215126727 10.464725
3 122633620 11101164672 10.870941
4 122713342 122623216 84.935547
... ... ... ...
147 13093009737 13093009736 27.866400
148 13093009737 13093009738 16.155781
149 13093009738 13093009737 16.155781
150 13093009738 13093009739 7.721657
151 13093009739 13093009738 7.721657

152 rows × 3 columns

[53]:
idxer = single_path_line.set_index(['from', 'to', 'length']).index
[54]:
irvine_net.edges_df[
    irvine_net.edges_df.set_index(["from", "to", "length"]).index.isin(idxer)
].explore(style_kwds={"weight": 5})
[54]:
Make this Notebook Trusted to load map: File -> Trust Notebook
[55]:
paths = irvine_net.shortest_paths([sse_node[0] for i in range(len(library_nodes))], library_nodes)
[56]:
# list of nodes in the shortest path from the school of social ecology to each of the libraries in Irvine
paths
[56]:
[array([11329030680,  8972594986,  8972595007,  8972595008, 11329030701,
         2523636562,  2523636559,  7041087144,  7041087148,  7041087147,
         7041087141, 12513737857,  9215126725,  9215110210, 11101164672,
          122633620,  9215126727,  9215110165,  2894898447,  2894898450,
         8921439881,  8921439880, 12377019591, 12377019589,  8921439876,
         8921439875, 12377019730,  8921439872,  9215110150,  9630951001,
         1832669174,  1836720579,  1836720582,  8921439815,   122779928,
          123058172, 11098805982,  1824581124,  1832669202,   122959101,
        11117464711,  2321316141,  2321316238,  2321316199,  2321316203,
        12372902839, 12372902837, 12384426815, 12384426818, 12384426846,
          123066066,   123066070,   122939960,   122746176,   123066075,
        12434680473, 12434680474, 12434680476,   123024133, 12434680475,
        12372902850,   122713342,   122623216,   122803528, 12384443880,
        12372831127,  2323342454,  2323342457,  9015654384, 12426331387,
        12426331391, 11611595661, 11611595403, 13093009736, 13093009737,
        13093009738, 13093009739]),
 array([11329030680, 11329030673, 11329030672,  7265551281, 12876134733,
         7265551280, 12510223139, 12510223138, 12510223136,  1702176836,
         8014795839,   122584522,  1822416127,  1822416139, 12805631600,
         1955728053,  1822416144,  2283655832,  1822618226,  1822416140,
         1822618219,  1822416121, 11725778956,  1822416113,  1680722085,
         1822416104,  1822416101,  1822416079,  1822416041, 12791076917,
        11309020905, 12791076914, 12791076912,   122738454,  1680722684,
         1680722111,  3075817566, 11090110120, 11103388618,  2283650243,
        11103388255]),
 array([11329030680,  8972594986,  8972595007,  8972595008, 11329030701,
         2523636562,  2523636559,  7041087144,  7041087148,  7041087147,
         7041087141, 12513737857,  9215126725,  9215110210, 11101164672,
          122633620,  9215126727,  9215110165,  2894898447,  2894898450,
         8921439881,  8921439880, 12377019591, 12377019589,  8921439876,
         8921439875, 12377019730,  8921439872,  9215110150,  9630951001,
        12509680150,  8921439798,  8921439811,  1834841304, 11098805981,
        11117374067,  1833732348,  1824581813,  1833732366, 11117464714,
         9106094272, 13252571443,  9106094276,  9106094287,  1584155982,
        11342675952, 12430198896, 11342675964,  2323342702,  9857103060,
        12505338657,  9857103064,  9857103066,  9857103065, 12427146524,
        12427136992, 12427136988, 11911593301, 12384499433, 11911593299,
        11911593284, 12385530270, 12384499467, 12384499443, 12384499269,
        12384499470, 12384499156, 12384499236, 12384499235, 12384499232,
        12384499309, 13282432746, 13282432744, 13282432735,  9075049245,
         9075049233,  6853713823,  6853713821, 13282412090, 13282412099,
        13282412094, 13282428603, 13282412092, 13282426117, 13282426118,
        13282426119, 11141153913, 11141153904, 11141153945, 11141153950,
          122889320, 11141153897,  5738412452,   122796026,   122818924,
         3816113161,  3816113159, 13276525101, 13276525134, 13276517000,
        13276525187,  2232478037, 12475968536,  4794678089,  4794678104,
         4794678119]),
 array([11329030680, 11329030673, 11329030672,  7265551281, 12876134733,
         7265551280, 12510223139, 12510223138, 12510223136,  1702176836,
         8014795839,   122584522,  1955727893,  1955727850]),
 array([11329030680,  8972594986,  8972595007,  8972595008, 11329030701,
         2523636562,  2523636559,  7041087144,  7041087148,  7041087147,
         7041087141, 12513737857,  9215126725,  9215110210, 11101164672,
          122633620,  9215126727,  9215110165,  2894898447,  2894898450,
         8921439881,  8921439880, 12377019591, 12377019589,  8921439876,
         8921439875, 12377019730,  8921439872,  9215110150,  9630951001,
         1832669174,  1836720579,  1836720582,  8921439815,   122779928,
          123058172, 11098805982,  1824581124,  1832669202,   122959101,
        11117464711,  2321316141,  2321316238,  2321316199,  9467725934,
         2321316237,  4085633301,  9467725918,  2321316252,  7273512222,
         1271623310,  5560127643, 10923017435,  1832661725,  1271623307,
         5211361742,  6742967910,  5211361724,  1271623326,  1271623313,
         1271623347, 10262398398, 11702283859, 12385253601, 12385253605,
         2172102465,  2172102505,  6382613544,  2172102424,  2172102444,
         8855670395,  2172102384,  8855712754]),
 array([11329030680,  8972594986,  8972595007,  8972595008, 11329030701,
         2523636562,  2523636559,  7041087144,  7041087148,  7041087147,
         7041087141, 12513737857,  9215126725,  9215110210, 11101164672,
          122633620,  9215126727,  9215110165,  2894898447,  2894898450,
         8921439881,  8921439880, 12377019591, 12377019589,  8921439876,
         8921439875, 12377019730,  8921439872,  9215110150,  9630951001,
        12509680150,  8921439798,  8921439811,  1834841304, 11098805981,
        11117374067,  1833732348,  1824581813,  1833732366, 11117464714,
         9106094272, 13252571443,  9106094276,  9106094287,  1584155982,
        11342675952, 12430198896, 11342675964,  2323342702,  9857103060,
        12505338657,  9857103064,  9857103066,  9857103065, 12427146524,
        12427136992, 12427136988, 11911593301, 12384499433, 11911593299,
        11911593284, 12385530270, 12384499467, 12384499443, 12384499269,
        12384499470, 12384499156, 12384499236, 12384499235, 12384499232,
        12384499309, 13282432746, 13282432744, 13282432735,  9075049245,
         9075049233,  6853713823,  6853713821, 13282412090, 13282412099,
        13282412094, 13282428603, 13282412092, 13282426117, 13282426118,
        13282426119, 11141153913, 11141153904,  6796121074, 11141153953,
         1261518642,  3816113173, 11141153951,  7103768394,  6335188473,
         7103768388,  6335188477,  4085081734, 11141153878, 11141153876,
        11141153880, 11141153871, 11141153851, 11141153840, 11141153843,
        11141153847,  4630870917, 11141095198, 11141095204, 11141095174,
        11141095164, 12523116333, 12523116332,   122648357,   122648348,
         2385041252,  8335524671,  3211898001,  8335524672,   122749002,
         5205526753,  5205392634,  1226041125,  1952096194,  5205403255,
         5205403253,  5205403252,  5205403250,  5205403248,  5205403246,
         5205403244,  5205403242,  5205403239,  5205403238,  1226041097,
         5205403229,  5205437584,  5205437588,  5205437590,  5205437615,
         5205437587,  1226041128,  5205437599,  5205403265, 11174324771,
        11174324768,  6348382867,  6348382081, 11174324841,  6348382080,
         6348382066,  6348382799,  6348382798,  6348382828,  6348382796]),
 array([11329030680,  8972594986,  8972595007,  8972595008, 11329030701,
         2523636562,  2523636559,  7041087144,  7041087148,  7041087147,
         7041087141, 12513737857,  9215126725,  9215110210, 11101164672,
          122633620,  9215126727,  9215110165,  2894898447,  2894898450,
         8921439881,  8921439880, 12377019591, 12377019589,  8921439876,
         8921439875, 12377019730,  8921439872,  9215110150,  9630951001,
         1832669174,  1836720579,  1836720582,  8921439815,   122779928,
          123058172, 11098805982,  1824581124,  1832669202,   122959101,
         1833732393, 11117464712,  7071617063, 11756951887,  8912270032,
         7911651333,  7911651341,   122652570,   122657415,  9467661667,
         3812990335,   122900129])]
[57]:
# shortest path from SSE to last library
irvine_net.edges_df[
    (irvine_net.edges_df["from"].isin(paths[-1])) & (irvine_net.edges_df["to"].isin(paths[-1]))
].explore(style_kwds={"weight": 5})
[57]:
Make this Notebook Trusted to load map: File -> Trust Notebook
[ ]: