diff --git a/docs/_modules/spaghetti/network.html b/docs/_modules/spaghetti/network.html index 8b04eef3..25c41f4e 100644 --- a/docs/_modules/spaghetti/network.html +++ b/docs/_modules/spaghetti/network.html @@ -153,9 +153,11 @@

Source code for spaghetti.network

     Parameters
     ----------
     
-    in_data : {geopandas.GeoDataFrame, str}
+    in_data : {str, list, tuple, numpy.ndarray, libpysal.cg.Chain, geopandas.GeoDataFrame}
         The input geographic data. Either (1) a path to a shapefile
-        (str); or (2) a ``geopandas.GeoDataFrame``.
+        (str); (2) an iterable containing ``libpysal.cg.Chain``
+        objects; (3) a single ``libpysal.cg.Chain``; or
+        (4) a ``geopandas.GeoDataFrame``.
     
     vertex_sig : int
         Round the x and y coordinates of all vertices to ``vertex_sig``
@@ -273,6 +275,7 @@ 

Source code for spaghetti.network

     :cite:`Ducruet2014`, :cite:`Weber2016`, for more in-depth discussion on
     spatial networks, graph theory, and location along networks. 
     For related network-centric software see
+    `Snkit <https://github.com/tomalrussell/snkit>`_ :cite:`tom_russell_2019_3379659`,
     `SANET <http://sanet.csis.u-tokyo.ac.jp>`_ :cite:`Okabe2006a`,
     `NetworkX <https://networkx.github.io>`_ :cite:`Hagberg2008`, 
     `Pandana <http://udst.github.io/pandana/>`_ :cite:`Foti2012`,
@@ -523,27 +526,48 @@ 

Source code for spaghetti.network

             setattr(self, obj_type + attr_str, attr)
def _extractnetwork(self): - """Used internally to extract a network from a polyline - shapefile of a ``geopandas.GeoDataFrame``. + """Used internally to extract a network. """ # initialize vertex count vertex_count = 0 - # determine if input network data is coming from - # shapefile or a geopandas.GeoDataFrame - if isinstance(self.in_data, str): + # determine input network data type + in_dtype = str(type(self.in_data)).split("'")[1] + is_libpysal_chains = False + supported_iterables = ["list", "tuple", "numpy.ndarray"] + # type error message + msg = "'%s' not supported for point pattern instantiation." + + # set appropriate geometries + if in_dtype == "str": shps = open(self.in_data) - else: + elif in_dtype in supported_iterables: + shps = self.in_data + shp_type = str(type(shps[0])).split("'")[1] + if shp_type == "libpysal.cg.shapes.Chain": + is_libpysal_chains = True + else: + raise TypeError(msg % shp_type) + elif in_dtype == "libpysal.cg.shapes.Chain": + shps = [self.in_data] + is_libpysal_chains = True + elif in_dtype == "geopandas.geodataframe.GeoDataFrame": shps = self.in_data.geometry + else: + raise TypeError(msg % in_dtype) # iterate over each record of the network lines for shp in shps: - # fetch all vertices between euclidean segments - # in the line record -- these vertices are - # coordinates in an (x, y) tuple. - vertices = weights._contW_lists._get_verts(shp) + # if the segments are native pysal geometries + if is_libpysal_chains: + vertices = shp.vertices + else: + # fetch all vertices between euclidean segments + # in the line record -- these vertices are + # coordinates in an (x, y) tuple. + vertices = weights._contW_lists._get_verts(shp) # iterate over each vertex (v) for i, v in enumerate(vertices[:-1]): @@ -987,7 +1011,6 @@

Source code for spaghetti.network

 
                 # for each network link (2)
                 for neigh in links:
-
                     # skip if comparing link to itself
                     if key == neigh:
                         continue
@@ -1012,6 +1035,9 @@ 

Source code for spaghetti.network

                     if key[1] > neigh[1]:
                         working = False
 
+            if len(links) == 1:
+                working = False
+
         # call libpysal for `W` instance
         w = weights.W(neighbors, weights=_weights)
 
@@ -2831,9 +2857,11 @@ 

Source code for spaghetti.network

     Parameters
     ----------
     
-    in_data : {geopandas.GeoDataFrame, str}
+    in_data : {str, list, tuple, numpy.ndarray, libpysal.cg.Point, geopandas.GeoDataFrame}
         The input geographic data. Either (1) a path to a shapefile
-        ``str``; or (2) a ``geopandas.GeoDataFrame``.
+        (str); (2) an iterable containing ``libpysal.cg.Point``
+        objects; (3) a single ``libpysal.cg.Point``; or
+        (4) a ``geopandas.GeoDataFrame``.
         
     idvariable : str
         Field in the shapefile to use as an ID variable.
@@ -2889,27 +2917,51 @@ 

Source code for spaghetti.network

         self.points = {}
         self.npoints = 0
 
+        # determine input point data type
+        in_dtype = str(type(in_data)).split("'")[1]
         # flag for points from a shapefile
-        if isinstance(in_data, str):
+        from_shp = False
+        # flag for points as libpysal.cg.Point objects
+        is_libpysal_points = False
+        supported_iterables = ["list", "tuple", "numpy.ndarray"]
+        # type error message
+        msg = "'%s' not supported for point pattern instantiation."
+
+        # set appropriate geometries
+        if in_dtype == "str":
             from_shp = True
-        else:
+        elif in_dtype in supported_iterables:
+            dtype = str(type(in_data[0])).split("'")[1]
+            if dtype == "libpysal.cg.shapes.Point":
+                is_libpysal_points = True
+            else:
+                raise TypeError(msg % dtype)
+        elif in_dtype == "libpysal.cg.shapes.Point":
+            in_data = [in_data]
+            is_libpysal_points = True
+        elif in_dtype == "geopandas.geodataframe.GeoDataFrame":
             from_shp = False
+        else:
+            raise TypeError(msg % in_dtype)
 
         # either set native point ID from dataset or create new IDs
-        if idvariable:
+        if idvariable and not is_libpysal_points:
             ids = weights.util.get_ids(in_data, idvariable)
         else:
             ids = None
 
         # extract the point geometries
-        if from_shp:
-            pts = open(in_data)
+        if not is_libpysal_points:
+            if from_shp:
+                pts = open(in_data)
+            else:
+                pts_objs = list(in_data.geometry)
+                pts = [cg.shapes.Point((p.x, p.y)) for p in pts_objs]
         else:
-            pts_objs = list(in_data.geometry)
-            pts = [cg.shapes.Point((p.x, p.y)) for p in pts_objs]
+            pts = in_data
 
         # fetch attributes if requested
-        if attribute:
+        if attribute and not is_libpysal_points:
 
             # open the database file if data is from shapefile
             if from_shp:
diff --git a/docs/_static/references.bib b/docs/_static/references.bib
index 46771b2c..f520770f 100644
--- a/docs/_static/references.bib
+++ b/docs/_static/references.bib
@@ -379,3 +379,13 @@ @article{ReVelle2005
 volume = {165},
 year = {2005}
 }
+
+@misc{tom_russell_2019_3379659,
+  author = {Tom Russell and Elco Koks},
+  title = {{tomalrussell/snkit: v1.6.0}},
+  month = aug,
+  year = {2019},
+  publisher = {Zenodo},
+  version = {v1.6.0},
+  doi  = {10.5281/zenodo.3379659}
+ }
\ No newline at end of file
diff --git a/docs/generated/spaghetti.Network.html b/docs/generated/spaghetti.Network.html
index 4dc1f9bc..460f2115 100644
--- a/docs/generated/spaghetti.Network.html
+++ b/docs/generated/spaghetti.Network.html
@@ -139,8 +139,10 @@ 

spaghetti.Network
Parameters
-
in_data{geopandas.GeoDataFrame, str}

The input geographic data. Either (1) a path to a shapefile -(str); or (2) a geopandas.GeoDataFrame.

+
in_data{str, list, tuple, numpy.ndarray, libpysal.cg.Chain, geopandas.GeoDataFrame}

The input geographic data. Either (1) a path to a shapefile +(str); (2) an iterable containing libpysal.cg.Chain +objects; (3) a single libpysal.cg.Chain; or +(4) a geopandas.GeoDataFrame.

vertex_sigint

Round the x and y coordinates of all vertices to vertex_sig significant digits (combined significant digits on the left and @@ -171,10 +173,11 @@

spaghetti.Network[DB14], [Web16], for more in-depth discussion on spatial networks, graph theory, and location along networks. For related network-centric software see -SANET [OOS06], -NetworkX [HSS08], -Pandana [FWL12], -and OSMnx [Boe17].

+Snkit [RK19], +SANET [OOS06], +NetworkX [HSS08], +Pandana [FWL12], +and OSMnx [Boe17].

Examples

Create an instance of a network.

>>> import spaghetti
@@ -414,8 +417,8 @@ 

spaghetti.NetworkNotes

-

Based on [OSullivanU10] and mentioned in -[OS12c].

+

Based on [OSullivanU10] and mentioned in +[OS12c].

Examples

Create a network instance.

>>> import spaghetti
@@ -479,8 +482,8 @@ 

spaghetti.NetworkNotes

-

Based on [OSullivanU10] and mentioned in -[OS12c].

+

Based on [OSullivanU10] and mentioned in +[OS12c].

[note from jlaura] Both the G and K functions generate a full distance matrix. This is because, I know that the full generation is correct and I believe that the truncated generated, @@ -548,8 +551,8 @@

spaghetti.NetworkNotes

-

Based on [OY01] -and [OS12b].

+

Based on [OY01] +and [OS12b].

[note from jlaura] Both the G and K functions generate a full distance matrix. This is because, I know that the full generation is correct and I believe that the truncated generated, @@ -754,7 +757,7 @@

spaghetti.NetworkNotes

-

See [RA07] and [RWK+19] for more details.

+

See [RA07] and [RWK+19] for more details.

Examples

Instantiate a network.

>>> import spaghetti
@@ -886,7 +889,7 @@ 

spaghetti.NetworkNotes

-

See [AR14] and [RAL+15] for more details +

See [AR14] and [RAL+15] for more details regarding spatial weights.

Examples

Instantiate an instance of a network.

@@ -994,7 +997,7 @@

spaghetti.NetworkNotes

-

Based on [Dij59] and [OS12a].

+

Based on [Dij59] and [OS12a].

@@ -1187,7 +1190,7 @@

spaghetti.Network
Parameters
-
in_data{geopandas.GeoDataFrame, str}

The input geographic data. Either (1) a path to a +

in_data{geopandas.GeoDataFrame, str}

The input geographic data. Either (1) a path to a shapefile (str); or (2) a geopandas.GeoDataFrame.

namestr

Name to be assigned to the point dataset.

@@ -1202,7 +1205,7 @@

spaghetti.NetworkNotes

-

See [GFH19] for a detailed discussion on +

See [GFH19] for a detailed discussion on the modeling consequences of snapping points to spatial networks.

Examples

Instantiate a network.

diff --git a/docs/generated/spaghetti.PointPattern.html b/docs/generated/spaghetti.PointPattern.html index bd9db7d9..72a6a8fd 100644 --- a/docs/generated/spaghetti.PointPattern.html +++ b/docs/generated/spaghetti.PointPattern.html @@ -139,8 +139,10 @@

spaghetti.PointPattern
Parameters
-
in_data{geopandas.GeoDataFrame, str}

The input geographic data. Either (1) a path to a shapefile -str; or (2) a geopandas.GeoDataFrame.

+
in_data{str, list, tuple, numpy.ndarray, libpysal.cg.Point, geopandas.GeoDataFrame}

The input geographic data. Either (1) a path to a shapefile +(str); (2) an iterable containing libpysal.cg.Point +objects; (3) a single libpysal.cg.Point; or +(4) a geopandas.GeoDataFrame.

idvariablestr

Field in the shapefile to use as an ID variable.

diff --git a/docs/generated/spaghetti.element_as_gdf.html b/docs/generated/spaghetti.element_as_gdf.html index 1581ff93..cf4502ed 100644 --- a/docs/generated/spaghetti.element_as_gdf.html +++ b/docs/generated/spaghetti.element_as_gdf.html @@ -159,11 +159,11 @@

spaghetti.element_as_gdfReturns
-
pointsgeopandas.GeoDataFrame

Network point elements (either vertices or network.PointPattern +

pointsgeopandas.GeoDataFrame

Network point elements (either vertices or network.PointPattern points) as a geopandas.GeoDataFrame of shapely.geometry.Point objects with an "id" column and "geometry"" column.

-
linesgeopandas.GeoDataFrame

Network arc elements as a geopandas.GeoDataFrame of +

linesgeopandas.GeoDataFrame

Network arc elements as a geopandas.GeoDataFrame of shapely.geometry.LineString objects with an "id" column and "geometry" column.

diff --git a/docs/objects.inv b/docs/objects.inv index 2332d7d7..b574e28a 100644 Binary files a/docs/objects.inv and b/docs/objects.inv differ diff --git a/docs/references.html b/docs/references.html index e305ccfd..8e804489 100644 --- a/docs/references.html +++ b/docs/references.html @@ -209,6 +209,9 @@

ReferencesRAL+15

Sergio J. Rey, Luc Anselin, Xun Li, Robert Pahle, Jason Laura, Wenwen Li, and Julia Koschinsky. Open Geospatial Analytics with PySAL. ISPRS International Journal of Geo-Information, 4(2):815–836, 2015. doi:doi:10.3390/ijgi4020815.

+
RK19
+

Tom Russell and Elco Koks. tomalrussell/snkit: v1.6.0. August 2019. doi:10.5281/zenodo.3379659.

+
TFL83

Barbaros C Tansel, Richard L Francis, and Timothy J Lowe. State of the Art—Location on Networks: A survey. Part I: The p-center and p-median Problems. Management Science, 29(4):482–497, 1983. doi:https://doi.org/10.1287/mnsc.29.4.482.

diff --git a/docs/searchindex.js b/docs/searchindex.js index efdde43f..886823af 100644 --- a/docs/searchindex.js +++ b/docs/searchindex.js @@ -1 +1 @@ -Search.setIndex({docnames:["api","generated/spaghetti.Network","generated/spaghetti.Network.loadnetwork","generated/spaghetti.Network.savenetwork","generated/spaghetti.PointPattern","generated/spaghetti.element_as_gdf","index","installation","notebooks/Advanced_spaghetti_tutorial","notebooks/Basic_spaghetti_tutorial","notebooks/Use_case-facility_location","references","tutorial"],envversion:{"sphinx.domains.c":1,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":1,"sphinx.domains.javascript":1,"sphinx.domains.math":2,"sphinx.domains.python":1,"sphinx.domains.rst":1,"sphinx.domains.std":1,"sphinx.ext.intersphinx":1,"sphinx.ext.viewcode":1,nbsphinx:1,sphinx:56},filenames:["api.rst","generated/spaghetti.Network.rst","generated/spaghetti.Network.loadnetwork.rst","generated/spaghetti.Network.savenetwork.rst","generated/spaghetti.PointPattern.rst","generated/spaghetti.element_as_gdf.rst","index.rst","installation.rst","notebooks/Advanced_spaghetti_tutorial.ipynb","notebooks/Basic_spaghetti_tutorial.ipynb","notebooks/Use_case-facility_location.ipynb","references.rst","tutorial.rst"],objects:{"spaghetti.Network":{NetworkF:[1,1,1,""],NetworkG:[1,1,1,""],NetworkK:[1,1,1,""],__init__:[1,1,1,""],allneighbordistances:[1,1,1,""],compute_distance_to_vertices:[1,1,1,""],compute_snap_dist:[1,1,1,""],contiguityweights:[1,1,1,""],count_per_link:[1,1,1,""],distancebandweights:[1,1,1,""],enum_links_vertex:[1,1,1,""],extract_components:[1,1,1,""],extractgraph:[1,1,1,""],full_distance_matrix:[1,1,1,""],loadnetwork:[2,1,1,""],nearestneighbordistances:[1,1,1,""],savenetwork:[3,1,1,""],simulate_observations:[1,1,1,""],snapobservations:[1,1,1,""],split_arcs:[1,1,1,""]},"spaghetti.PointPattern":{__init__:[4,1,1,""]},spaghetti:{Network:[1,0,1,""],PointPattern:[4,0,1,""],element_as_gdf:[5,2,1,""]}},objnames:{"0":["py","class","Python class"],"1":["py","method","Python method"],"2":["py","function","Python function"]},objtypes:{"0":"py:class","1":"py:method","2":"py:function"},terms:{"013617549x":11,"0x104dcca58":8,"0x107278080":8,"0x120889048":8,"25km":10,"31t20":[8,9,10],"4th":11,"64bit":[8,9,10],"66667e":10,"7th":11,"8km":10,"case":[1,10],"class":[1,4],"default":[1,4,5,8,10],"final":[8,9,10],"float":[1,8,10],"function":[1,5,11],"import":[1,3,5,8,9,10],"int":[1,4,10],"new":[1,10,11],"public":6,"return":[1,2,5,10],"static":[1,2],"super":10,"switch":[10,11],"true":[1,4,5,8,10],"try":10,"while":[1,10],And:1,For:1,IDs:[1,4,5],Its:11,One:[],That:1,The:[1,2,3,4,10,11],Their:11,There:[1,10],Use:1,Using:[1,7],With:1,__class__:8,__delattr__:8,__dict__:8,__dir__:8,__doc__:8,__eq__:8,__format__:8,__ge__:8,__getattribute__:8,__gt__:8,__hash__:8,__init__:[1,4,8,10],__init_subclass__:8,__le__:8,__lt__:8,__module__:8,__ne__:8,__new__:8,__reduce__:8,__reduce_ex__:8,__repr__:8,__setattr__:8,__sizeof__:8,__str__:8,__subclasshook__:8,__weakref__:8,_highlight_membership:10,_moran__calc:8,_moran__mo:8,_redirect_to_fil:10,_shellmodel:10,_sol:10,_statist:8,_subplot:[8,10],abov:[1,6,7],abs_max:10,abs_min:10,absolut:[10,11],access:[1,11],accur:[1,4],acord:10,acquir:11,activ:6,adapt:10,add:[9,10],add_constr:10,add_legend:10,add_north_arrow:10,add_obj:10,add_result:10,add_scal:10,add_to_legend:10,add_to_plot:10,add_var:10,addtion:[8,9,10],adjac:[1,8],adjacencylist:1,advanc:12,advanced_spaghetti_tutori:8,afford:10,ahuja:11,ai_sum:10,aij:10,algorithm:[10,11],all:[1,4,7,9],all_dist:1,allneighbordist:[1,10],along:[1,4,5,11],alpha:[8,9,10],alpha_shape_auto:10,alreadi:5,also:[1,7,10],alwai:[1,10],amo93:[1,11],anaconda:7,analysi:[1,6,10,11],analyt:[1,11],analytics_df:10,analytics_displai:10,analytics_matrix:10,analyz:11,anchor:10,ani:[1,8,9,10],anoth:1,anselin:11,api:6,appear:10,append:10,appli:10,applic:[10,11],appreci:6,approxim:1,ar14:[1,11],arc:[1,4,5],arc_length:[1,8],arcs200_df:8,arcs_df:[5,8,9],area:10,arg:9,argument:[1,9],aric:11,arrai:[1,10],arriba:11,arrow:10,art:11,articl:11,articul:1,arw:10,as_cmap:10,ask:10,assign:[1,10],associ:[1,5,10,11],assum:1,astyp:10,atsuyki:11,atsuyuki:11,attempt:10,attr:10,attribut:[1,4,8,10],attributeerror:10,author:[4,6,8,9,10],aux_to_plot:10,avail:1,averag:10,avoid:7,axarr:10,axes:[8,10],axessubplot:[8,10],axi:10,b978:11,background:10,background_gradi:10,barbaro:11,barth:11,barthelemy11:[1,11],base:[1,6,8,9,12],basic:[1,11,12],basic_spaghetti_tutori:9,bbox:10,bbox_prop:10,bbox_to_anchor:[9,10],beauguitt:11,becaus:1,been:[1,10],being:[1,5,8,10],bel:11,believ:[1,10],bennett:11,bergman:[10,11],best:8,between:[1,8,10],bf01386390:11,bibtex:6,binari:[1,2,3,8,10],blue:8,blueviolet:10,board:11,boe17:[1,11],boe:11,boiler:10,book:10,bool:[1,4,5,10],both:[1,5],bound:1,boxstyl:10,bridg:1,bring:10,british:11,budget:10,buff:10,buffer:10,bug:1,build:[6,8,10],build_:10,build_lscp:10,build_mclp:10,build_pcp:10,build_pmp:10,by_col:8,c_arrai:10,calc:10,calcul:[1,5],call:[1,8],can:[1,5,7,10],carlo:8,cbc_mixed_integer_program:10,cbo9781107415324:11,ccv:10,cdv:10,cdv_label:10,cell:10,center:11,central:[10,11],centric:1,ch3:11,ch5:11,ch6:11,ch81:[1,11],chang:7,channel:7,channel_prior:7,chapter:11,charl:[6,10,11],chicago:11,chose:10,church1974:[],church:[10,11],cij:10,citat:[6,12],cite:[8,9,10],clang:[8,9,10],cli2fac:10,cli2iloc:10,cli2ncov:10,cli_df:10,cli_snp:10,cli_tru:10,cli_var:10,client_count:10,clients_snap:10,cliff:11,clone:7,close:[1,10],cmap:[9,10],col:10,col_nam:10,collect:10,color:[8,9,10],column:[1,5,9,10],colun:10,com:[6,7,8,9,10,11],combin:[1,9],command:7,committe:10,compar:[9,10],compenvurbsi:11,compil:[8,9,10],complet:10,complex:11,compon:1,compos:8,compris:1,comput:[1,2,8,11],compute_distance_to_vertic:1,compute_snap_dist:1,concav:10,concave_hul:10,conda:[8,9,10],conduct:1,confer:11,config:7,configur:10,connect:[1,11],connexion:11,consequ:1,constantin:11,constr:10,constrain:1,constraint:[10,11],construct:11,contain:[1,7],content:12,contigu:1,contiguityweight:[1,8],continu:10,contraint:10,contribut:7,control:1,convent:1,convert:[4,8,10],coord:[1,8,9],coordin:[1,4,8,10],coral:10,core:[1,8,9,10],corner:10,correct:1,corrupt:10,cost1_1:10,cost1_2:10,cost1_3:10,cost:1,cost_matrix:10,count:[1,10],count_per_link:[1,8],cov_count:10,cover:11,coverag:10,cpu:[8,9,10],cpython:[8,9,10],cr74:[11,12],creat:[1,3,7],create_patch:10,crime:[1,8],crimes_fil:1,crs:10,current:[1,3,7,8,10],custom:1,cyan:10,d2d_dist:1,daniel:11,darkcyan:10,darkgoldenrod:10,darkslategrai:10,darwin:[8,9,10],das13:[1,11],daskin:[10,11],data:[1,4,6,7],dataset:[1,10],david:[6,11],db14:[1,11],decid:10,decim:1,decis:10,declar:1,decompress:7,def:10,default_dict:4,defin:1,degre:1,demonstr:1,demostr:12,denni:11,densiti:10,depend:7,dependeci:[8,9,10],depth:1,deriv:8,descart:[9,10],descript:10,desir:[1,10],destin:[1,7,10],destpattern:[1,10],detail:[1,7],develop:6,diagon:1,dict:[1,4,8,10],dict_kei:1,dictionari:1,differ:8,digit:1,dij59:[1,11],dijkstra:11,dimens:10,dir:8,directli:1,directori:[1,3],discret:[10,11],discuss:1,disk:[1,2,3],displai:10,dist:[1,10],dist_snap:8,dist_to_vertex:[4,8],distanc:[1,4,8,11],distance_matrix:1,distancebandweight:1,distirbut:8,distribut:[1,7],divis:1,docsrc:[8,9,10],doe:5,doi:[6,11],dominiqu:11,done:8,download:7,dtype:[1,5],ducruet:11,due:10,duplic:1,duqu:11,dv_color:10,dv_colorset:10,dvs:10,dvs_to_leg:10,dynam:11,each:[1,4,10],econom:11,econometr:11,edg:[1,8,9],edge_length:1,edgecolor:10,edit:11,editor:11,effect:11,ei_sim:8,eight:[],eiselt:11,either:[1,4,5],ejor:11,element:[1,5,8,10],element_as_gdf:[8,9,10],elif:10,els:10,elsevi:11,emerg:[10,11],empti:10,encount:8,encyclopedia:11,end:1,englewood:11,ensur:7,entri:[6,9],enum_links_vertex:1,enumer:[1,8,10],environ:[7,11],epsg:10,equal:[1,10],equit:10,esda:[1,11],euclidean:1,european:11,event:6,everi:[8,10],exact:1,exactli:1,examin:5,exampl:[1,3,5,8,9],except:[5,10],exclud:[1,4,10],exist:[1,5],explan:10,explicityli:10,explor:[8,11],exportmodelaslpformat:10,extend:10,extra:10,extract:[1,5],extract_compon:1,extractgraph:1,f_arrai:10,fac2cli:10,fac2iloc:10,fac2selectcount:10,fac:10,fac_df:10,fac_snp:10,fac_tru:10,fac_var:10,facecolor:10,facil:[6,11,12],facilit:10,facilities_snap:10,facility_count:10,facility_loc:10,facilitylocationmodel:10,fals:[1,4,5,8,9,10],famili:10,fancybox:[9,10],fdv:10,fdv_label:10,feasibl:10,feet:1,fernand:11,fetch:1,field:4,fig:10,figsiz:[8,9,10],figur:[8,10],file:[1,2,3,10],filenam:[1,2,3],fill:[1,10],fill_diagon:1,filler:10,fillna:10,filterwarn:[8,10],find:1,first:[1,5],five:[],fix:1,flag:[1,4],flatten:10,fletcher:11,flow:[1,11],folch:[6,11],folder:7,follow:[1,6,7],folow:10,fontsiz:[8,9,10],fontstyl:10,fontweight:10,for_multiplot:10,forg:[7,9,10],fork:7,form:[1,4,8],format:10,formul:10,forth:10,foti:11,found:[8,9,10],four:10,framealpha:[9,10],framework:11,fran:11,franci:11,fre:[1,8],free:[7,10],freewai:11,from:[1,2,3,4,5,6,11],fuchsia:10,full:[1,3,8,10],full_distance_matrix:1,fulli:8,fundament:10,futur:4,fwl12:[1,11],gaboardi2018:6,gaboardi:[6,8,9,10,11],gean:11,gen_tre:1,gener:[1,4,9,11],geo:11,geocod:1,geoda:11,geodaspac:11,geodatafram:[1,4,5,10],geoff:11,geograph:[1,4,10,11],geographi:11,geojson:8,geom:10,geom_col:5,geometri:[5,9,10],geopanda:[1,4,5,10],geoseri:10,geospati:11,get_buff:10,get_fram:10,get_path:[1,3,5,8,9,10],get_xlim:10,get_ylim:10,getattr:10,gfh19:[1,11],git:7,github:[6,7],give:10,given:1,gmail:[8,9,10],going:10,graph:[1,10,11],graph_component2edg:1,graph_component_is_r:1,graph_component_label:1,graph_n_compon:1,gre:[1,8],greater:1,green:10,grow:10,guid:[6,11],hagberg:11,haggett:11,hak64:[11,12],hakimi1964:[],hakimi:[10,11],half:1,hall:11,handbook:11,handl:[9,10],has:[1,10],have:[1,7,8,10],head:10,heavi:10,help:[1,4],here:[1,6,7],higher:1,highlight:10,histogram:1,horner:11,household:10,how:[1,7,10],howev:[1,10],hspace:10,hss08:[1,11],http:[6,7,11],hull:10,human:11,i386:[8,9,10],id_col:5,idvari:[1,4],idx:[1,10],ies:10,ignor:[8,10],ijgi4020815:11,ikuho:11,iloc:10,implement:11,importerror:10,in_data:[1,4,8,9,10],inc:[10,11],incid:[1,4,8],includ:[1,4,8],inclus:6,increment:8,index:[1,10],indexerror:1,indic:[1,4,10],individu:10,infin:10,info:10,inform:[1,4,10,11],initi:[1,4],inlin:[8,9,10],innov:11,inplac:10,input:[1,4,10],instal:[6,8,9,10],instanc:[1,3],instanti:[1,5],int32:1,integ:[1,10],interact:[8,9,10],intern:11,interpattern:1,interpret:[8,9,10],intersect:10,intrapattern:1,introduc:10,intvar:10,invalid:8,invers:1,ipynb:[8,9,10],ipython:[8,9,10],isbn:11,isin:10,isinst:1,island:1,isol:1,ispr:11,ital:10,item:10,iter:10,itm:11,its:[7,8,10],itself:1,ivar:10,jacqu:11,jai:6,jame:[6,8,9,10,11],januari:11,jarrod:11,jason:11,jgaboardi:[8,9,10],jlaura:1,joe:11,john:[6,10,11],journal:11,juli:11,julia:11,just:10,jvar:10,kang:[6,11],keep:1,keep_zero_dist:1,kegan:11,kei:[1,4,8,10],keiichi:11,keyerror:[5,10],keyword:[1,6,9],kitchin:11,know:1,kokichi:11,koschinski:11,kre:[1,8],krut09:[1,11],kubi:11,kwarg:9,labb:11,labbept95:[1,11],label:[1,8,9,10],label_calc:10,lambda:10,larg:[8,9,10],larger:[8,10],latex:10,laura:[6,11],laurent:11,lavend:10,least:10,leav:10,left:[1,4,10],legend:[8,10],legend_aux:10,lemi:11,len:[1,8,10],length:[1,5,8,10],less:8,lesser:1,level:[1,10],levi:6,lfl:10,libpys:[1,3,5,8,9],librari:[6,10,11],light_palett:10,lightskyblu:10,like:[1,8],limegreen:10,line2d:[9,10],line:[5,9,10],linear:10,linear_solv:10,linestr:[5,10],linewidth:[8,10],link:[1,6,7],list:[1,4,8,10],listedcolormap:10,littl:10,load:[1,2],load_ext:[8,9,10],loadnetwork:1,loc:[5,8,10],local:[7,10],locat:[1,4,5,6,11,12],london:11,longleftarrow:10,longrightarrow:10,lookup:[1,4,10],loop:1,low:11,lower:[1,8,10],lowerbound:1,lowerenvelop:[1,8],lp_formul:10,lscp:10,ltd:11,luc:11,lumnitz:11,luxen:11,machin:[8,9,10],made:1,magnanti:11,mai:[1,4,8,10],mainten:10,make:7,malizia:11,manag:[7,11],mani:1,manner:10,map:10,marc:11,mark:11,markdown:10,marker:[9,10],markeredgecolor:10,markers:[8,9,10],martin:11,mask:1,match:10,mathematik:11,matplotlib:[8,10],matrix:1,max:10,max_coverag:10,maxim:11,maximum:[1,10],mclp:10,mdl:10,mean:[1,10],mean_dist:10,mean_mean:10,mean_std:10,measur:11,median:11,mediumseagreen:10,mediumvioletr:10,member:10,membership:10,mention:1,mere:10,messag:[8,10],meter:[8,10],method:[1,4,6,10,11],metropolitan:11,mhwang4:11,millisecond:10,millman:11,mimic:10,min:10,min_coverag:10,miniconda:7,minim:[7,10],minimum:[1,10],minut:10,misc:6,mline:[9,10],mlyon:11,mnsc:11,model:[1,11,12],model_nam:10,modern:11,modul:6,monkei:4,mont:8,month:6,moran:1,more:[1,10],most:[7,10],most_coverag:10,move:10,mpatch:10,mpsolver:10,ms1:10,ms2:10,msize:10,multi_plott:10,multipl:10,multiplot:10,must:[1,5,10],mynetwork:[1,3],n200:[1,8],n_cli:10,n_cli_uncov:10,n_fac:10,n_process:1,name:[1,5,10],nan:[1,10],navig:7,ncli:10,ncov2ncli:10,ncov:10,ndarrai:[1,10],nearest:[1,4,10,11],nearestneighbordist:1,need:8,neg:1,neighbor:[1,8,10,11],neighborhood:10,net:5,nethod:11,netvtx1:4,netvtx2:4,network:[4,5,11,12],network_component2arc:1,network_component_is_r:1,network_component_label:1,network_n_compon:1,network_tre:1,networkf:[1,8],networkg:[1,8],networkk:[1,8],networkx:[1,11],never:1,newli:[1,6],next:1,nigel:11,nine:[],no_fac:10,node:[1,8,9],non:[1,10],non_articulation_point:1,non_obj_v:10,none:[1,4,5,10],north:10,note:[1,4,5,8,11],notebook:[8,9,10],notin:10,now:1,npoint:[1,4,8],npt:[1,8],nsnap:9,nstep:1,ntrue:9,ntw:[1,3,5,8,9,10],number:[1,4,8,10],numerisch:11,numpi:[1,8,10],numvar:10,obj:10,obj_val:10,object:[1,2,5],obs_id1:4,obs_id2:4,obs_idn:4,obs_on:1,obs_to_arc:[1,4,8],obs_to_edg:1,obs_to_vertex:[4,8],observ:[1,4],obtain:7,oct:6,ois:11,okab:11,okunuki:11,one:[1,10],onli:[1,7],onlin:[8,9,10],onto:1,oos06:[1,11],opaqu:8,open:[6,7,10,11],oper:[7,10,11],operations_research:10,opr:11,optim:[6,11,12],optimum:[10,11],option:1,ord:10,order:[5,10],ordereddict:10,org:11,orig_counts_per_link:8,origin:[1,4,6,10],orlin:11,os12a:[1,11],os12b:[1,11,12],os12c:[1,11,12],os12d:[1,11],osmnx:[1,11],osullivan:[],osullivandaunwindj10:[],osullivanu10:[1,11,12],other:[1,10],otherwis:1,ou10:[],out:[1,3],out_data:10,outcom:11,outsid:10,oxford:11,oy01:[1,11,12],p_facil:10,p_norm:8,p_rand:8,p_sim:8,p_z_sim:8,pad:10,page:[8,9,10,11],pahl:11,pair:4,panda:10,pandana:1,paper:[10,11],paramet:[1,2,3,4,5],part:[5,8,9,10,11],pasadena:11,pass:[1,10],patch:[4,10],path:[1,3,4,10],pattern:[1,4,5,11],paul:11,pcolor:10,pcp:10,pcp_sol:10,pdf:11,peachpuff:10,pedestrian:11,peeter:11,per:1,perc_serv:10,percent:10,percentag:10,perform:[1,8,10],permut:[1,8],person:10,philip:6,physic:11,physrep:11,pieter:11,pip:[7,10],pkl:[1,3],plabel:10,place:1,plan:10,pleas:[7,8,9,10],plot:8,plot_aux:10,plot_bas:10,plot_r:10,plotter:10,plt:[8,9,10],pmarker:10,pmp:10,png:10,point:[1,4,5,11],point_id:1,pointid:8,pointpattern:[1,5,8,9,10],poisson:1,polygon:10,popul:1,posit:1,post2:10,postiv:1,potenti:1,pp_name:[5,9,10],practic:11,pre:[1,2],precomput:8,predetermin:10,prefer:10,prentic:11,present:10,press:11,print:[8,9,10],print_result:10,print_sol:10,print_solut:10,problem:11,proceed:11,processor:[8,9,10],profession:11,professor:10,program:10,project:10,properti:[8,11],propos:6,provid:[1,6,10],proxi:10,prune:1,pseudo:10,psize:10,pt1_size:10,pt2_size:10,pt_str:1,pts_arrai:10,publish:10,pull:7,put:10,pyplot:[8,9,10],pysal:[4,6,7,11,12],python:[6,11],pywraplp:10,quantit:11,queri:1,r_cli:10,r_fac:10,ra07:[1,11],radiu:10,rais:[1,5,10],ral:[1,11],randint:10,random:1,random_pt:1,random_se:10,rang:10,rarrow:10,ravindra:11,raw:[1,5,8],re05:[11,12],read:[8,10],read_fil:10,readm:[8,9,10],reason:1,rebuild:1,reconstruct:1,record:[1,10],record_decis:10,red:8,refer:[1,6,8,9,10],regard:1,regener:8,region:[10,11],rei:[6,11],rel:8,relat:1,relationship:[10,11],releas:[8,9,10],release_900:[8,9,10],remaind:1,remedi:1,rememb:10,remov:1,replac:4,repo:7,report:11,repres:[1,10],represent:[1,6,10],request:[1,7],requir:[5,7,8,9,10],res:[1,8],res_to_plot:10,research:[8,9,10,11],reshap:10,resid:10,respect:10,result:1,retain:1,retina:10,revel:[10,11],revelle1970:[],revelle2005:[],revers:10,review:11,richard:11,right:[1,4],ring:1,road:10,rob:11,robert:11,rotat:10,round:[1,10],rout:11,routledg:11,row:10,rrs:11,rs70:[11,12],run:7,rwk:[1,11],s0927:11,s11067:11,s2d_dist:1,s2s_dist:1,saddlebrown:10,same:1,sampl:1,sanet:[1,11],sar:11,save:[1,2,3],save_fig:10,savefig:10,savenetwork:1,scale:[10,11],scatterpoint:9,scenario:1,schmidt:[6,11],scholasticahq:11,school:[1,8],schools_fil:1,schult:11,scienc:[7,10,11],scientif:6,scipi:11,scrime:9,seaborn:10,second:11,see:[1,4,10],seed:10,segm_counts_per_link:8,segment:[1,10],sei_norm:8,sei_rand:8,sei_sim:8,sel:10,select:7,selection_df:10,selection_displai:10,selection_matrix:10,selet:10,self:[1,2,3,4,10],semi:8,separ:7,sergio:[6,11],serv:10,serv_label:10,servic:[10,11],service_area:10,set:[1,5,7,8,9],set_aspect:10,set_capt:10,set_facecolor:10,set_matplotlib_format:10,set_titl:10,seth:11,seven:[],shape:[1,5,10],shapefil:[1,4,8,10],sharei:10,sharex:10,she:10,shell:7,shino:11,shiod:11,shortest:1,should:[1,3,8,10],show:[1,8],shown:1,shp:[1,3,5,10],signatur:[1,4],signific:1,sij:10,sim:[1,8],sim_pt:10,simplifi:[1,4],simul:1,simulate_observ:[1,8],simulated_geo_point:10,simulated_points_al:10,simulated_points_list:10,simulatedpointpattern:1,sinc:[8,10],singl:[1,8,10],site:10,six:[],size:10,skip:1,slightli:10,small:8,smoother:10,snap:[1,4,5],snap_dist:[1,4],snapobserv:[1,8,9,10],snapped_coordin:[4,8,9],snapped_crimes_df:9,snapped_schools_df:9,softwar:1,solution_valu:10,solve_minut:10,solver:10,solver_inst:10,son:[10,11],sort:[1,10],sourc:[1,2,3,4,5,6,7],sourcepattern:[1,10],space:10,spacer:10,spaghetti:12,spatial:[1,11],specif:[1,4,7,10],specifi:[1,10],split:[1,10],split_arc:[1,8],split_network:1,squeez:10,sschool:9,standard:1,stastist:10,stat:10,state:11,std:10,stdout:10,step:[1,10],stephen:[6,11],still:[1,8],stipul:10,store:[1,4],str:[1,2,3,4,5,10],strbuff:10,street:[1,3,5,8,9,11],streets_buff:10,streets_fil:1,strict:7,string:1,structur:[10,11],stub:4,studi:11,style:10,styler:10,styliz:10,submit:7,subplot:10,subplots_adjust:10,subset:10,sugihara:11,sullivan:11,sum:[1,5,8,10],supplement:10,suppli:8,support:[7,10],suptitl:10,sure:7,survei:11,sussex:11,swain:[10,11],swart:11,swig:10,symbol:10,synthesi:11,sys:10,system:[7,8,9,10,11],tab20:9,tag:[4,8,9,10],tansel:11,tar:7,tb00448:11,tb00902:11,tcc:11,tcrime:9,ten:[],term:1,text:10,tfl83:[1,11],than:[1,10],them:[1,10],theoret:[1,6,8],theori:[1,6,11],therefor:10,thi:[1,3,4,5,7,9],thiss:11,thistl:10,thoma:11,those:4,thought:1,three:[],threshold:1,thrift:11,through:[1,6,7,8,9],tiernei:11,time:[10,11],timothi:11,titl:[6,8,10],to_cr:10,to_fil:10,tolist:10,toolbox:11,top:[1,10],topolog:[8,11],torega:[10,11],toregas1971:[],toregas1972:[],total:[1,5,10],total_bound:10,toward:10,tr72:[11,12],translat:10,transpar:10,transport:11,travel:[10,11],travi:11,tree:1,tree_nearest:1,true_crimes_df:9,true_schools_df:9,truncat:1,tschool:9,tsrb71:[11,12],tupl:[1,4,10],turn:10,tutori:6,two:[1,4,11],type:[1,4,10],typeerror:10,unary_union:10,uncov:10,under:[6,10,11],understand:8,unforseen:10,uniform:[1,8,10],union:10,uniqu:1,unique_arc:1,unit:[1,10],univers:10,unless:1,unseg:8,unselect:10,unwin:11,upchurch:11,updat:[9,10],upper:[1,8,10],upperbound:1,upperenvelop:8,urban:11,url:[6,11],usa:11,usag:6,use:[4,6],use_cas:10,used:[1,4,8,9,10],user:8,using:[1,6,7,11],usr_warn:10,util:1,valid:1,valu:[1,4,8,10],valueerror:10,var_index:10,vari:10,variabl:[1,4,10],varoquaux:11,vaught:11,vector:[1,8,10],version:[8,9,10],vertex:[1,5,8],vertex_coord:[1,8],vertex_list:1,vertex_sig:1,vertic:[1,4,5],vertices200_df:8,vertices_df:[5,8,9],vi_norm:8,vi_rand:8,vi_sim:8,view:[10,11],visual:[10,11],volum:11,volunt:10,vstack:10,vtx0:1,vtx1:1,w_compon:1,w_graph:1,w_network:1,waddel:11,walk:[8,9],walltim:10,warn:[7,8,10],watermark:[8,9,10],web16:[1,11],weber:11,wei:6,weight:1,wenwen:11,west:11,when:[1,4,5,7,10],where:[1,2,3,10],whether:[1,4],which:[1,8],white:10,wilei:[10,11],within:[1,4,5,10],without:1,wolf:[6,11],worst:10,would:[1,6],wriglei:11,write:10,write_lp:10,wspace:10,x1_1:10,x1_2:10,x1_3:10,x2_1:10,x3_1:10,x86_64:[8,9,10],xaxi:8,xun:11,yamada:11,year:6,york:10,you:[6,7],your:[7,8,9,10],z2ss:8,z_norm:8,z_rand:8,z_sim:8,zenodo:[6,11],zero:[1,8,10],zorder:[9,10]},titles:["API reference","spaghetti.Network","spaghetti.Network.loadnetwork","spaghetti.Network.savenetwork","spaghetti.PointPattern","spaghetti.element_as_gdf","spaghetti","Installation","Advanced pysal.spaghetti tutorial","Basic pysal.spaghetti tutorial","Demostrating network-based optimal facility location modeling","References","Tutorial"],titleterms:{"case":8,"class":10,"function":[8,10],"true":9,abov:10,advanc:8,all:10,alloc:[8,9],alpha_shap:10,analysi:8,analyt:10,analyz:10,api:0,arc:[8,9],attribut:9,base:10,basic:9,best:10,calcul:[8,10],candid:10,cbc:10,center:10,cite:6,client:10,cluster:8,commun:10,comparis:10,comparison:9,conda:7,constrain:8,coordin:9,cost:10,count:8,cover:10,creat:[8,9,10],crime:9,data:10,datafram:10,defin:10,demand:10,demonstr:8,demostr:10,develop:7,digit:8,distanc:10,element_as_gdf:5,empir:10,empric:10,esda:8,exampl:10,extract:[0,8],facil:10,featur:0,feedstock:7,feet:8,fetch:10,file:[8,9],from:[8,9,10],gener:[8,10],geodatafram:[8,9],geopanda:[8,9],graph:[6,8],highli:7,hous:10,index:7,infer:6,instal:7,instanc:10,instanti:[0,8,9,10],instead:8,integr:10,intens:8,lai:10,legend:9,libpys:10,link:8,load:0,loadnetwork:2,locat:[9,10],matplotlib:9,matrix:10,maxim:10,median:10,minimax:10,model:10,moran:8,need:10,network:[0,1,2,3,6,8,9,10],nework:10,object:[8,9,10],observ:[8,9],optim:10,origin:9,ortool:10,out:10,packag:7,paramet:10,patch:9,pattern:8,per:[8,10],plot:[9,10],point:[8,9,10],pointpattern:4,problem:10,pysal:[8,9,10],python:7,random:10,randomli:10,recommend:[7,10],refer:[0,11],represent:8,result:10,save:0,savenetwork:3,scenario:10,school:9,segment:8,select:10,set:10,shp:[8,9],simul:8,snap:[8,9,10],solut:10,solv:10,spaghetti:[1,2,3,4,5,6,7,8,9,10],spatial:[6,8,10],split:8,street:10,suit:10,synthet:10,test:8,thi:[8,10],think:10,topolog:6,tutori:[8,9,12],use:10,using:8,util:10,version:7,vertic:[8,9],via:7,visual:[8,9],weight:10,which:10,without:9,would:10,you:10}}) \ No newline at end of file +Search.setIndex({docnames:["api","generated/spaghetti.Network","generated/spaghetti.Network.loadnetwork","generated/spaghetti.Network.savenetwork","generated/spaghetti.PointPattern","generated/spaghetti.element_as_gdf","index","installation","notebooks/Advanced_spaghetti_tutorial","notebooks/Basic_spaghetti_tutorial","notebooks/Use_case-facility_location","references","tutorial"],envversion:{"sphinx.domains.c":1,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":1,"sphinx.domains.javascript":1,"sphinx.domains.math":2,"sphinx.domains.python":1,"sphinx.domains.rst":1,"sphinx.domains.std":1,"sphinx.ext.intersphinx":1,"sphinx.ext.viewcode":1,nbsphinx:1,sphinx:56},filenames:["api.rst","generated/spaghetti.Network.rst","generated/spaghetti.Network.loadnetwork.rst","generated/spaghetti.Network.savenetwork.rst","generated/spaghetti.PointPattern.rst","generated/spaghetti.element_as_gdf.rst","index.rst","installation.rst","notebooks/Advanced_spaghetti_tutorial.ipynb","notebooks/Basic_spaghetti_tutorial.ipynb","notebooks/Use_case-facility_location.ipynb","references.rst","tutorial.rst"],objects:{"spaghetti.Network":{NetworkF:[1,1,1,""],NetworkG:[1,1,1,""],NetworkK:[1,1,1,""],__init__:[1,1,1,""],allneighbordistances:[1,1,1,""],compute_distance_to_vertices:[1,1,1,""],compute_snap_dist:[1,1,1,""],contiguityweights:[1,1,1,""],count_per_link:[1,1,1,""],distancebandweights:[1,1,1,""],enum_links_vertex:[1,1,1,""],extract_components:[1,1,1,""],extractgraph:[1,1,1,""],full_distance_matrix:[1,1,1,""],loadnetwork:[2,1,1,""],nearestneighbordistances:[1,1,1,""],savenetwork:[3,1,1,""],simulate_observations:[1,1,1,""],snapobservations:[1,1,1,""],split_arcs:[1,1,1,""]},"spaghetti.PointPattern":{__init__:[4,1,1,""]},spaghetti:{Network:[1,0,1,""],PointPattern:[4,0,1,""],element_as_gdf:[5,2,1,""]}},objnames:{"0":["py","class","Python class"],"1":["py","method","Python method"],"2":["py","function","Python function"]},objtypes:{"0":"py:class","1":"py:method","2":"py:function"},terms:{"013617549x":11,"0x104dcca58":8,"0x107278080":8,"0x120889048":8,"25km":10,"31t20":[8,9,10],"4th":11,"64bit":[8,9,10],"66667e":10,"7th":11,"8km":10,"case":[1,10],"class":[1,4],"default":[1,4,5,8,10],"final":[8,9,10],"float":[1,8,10],"function":[1,5,11],"import":[1,3,5,8,9,10],"int":[1,4,10],"new":[1,10,11],"public":6,"return":[1,2,5,10],"static":[1,2],"super":10,"switch":[10,11],"true":[1,4,5,8,10],"try":10,"while":[1,10],And:1,For:1,IDs:[1,4,5],Its:11,That:1,The:[1,2,3,4,10,11],Their:11,There:[1,10],Use:1,Using:[1,7],With:1,__class__:8,__delattr__:8,__dict__:8,__dir__:8,__doc__:8,__eq__:8,__format__:8,__ge__:8,__getattribute__:8,__gt__:8,__hash__:8,__init__:[1,4,8,10],__init_subclass__:8,__le__:8,__lt__:8,__module__:8,__ne__:8,__new__:8,__reduce__:8,__reduce_ex__:8,__repr__:8,__setattr__:8,__sizeof__:8,__str__:8,__subclasshook__:8,__weakref__:8,_highlight_membership:10,_moran__calc:8,_moran__mo:8,_redirect_to_fil:10,_shellmodel:10,_sol:10,_statist:8,_subplot:[8,10],abov:[1,6,7],abs_max:10,abs_min:10,absolut:[10,11],access:[1,11],accur:[1,4],acord:10,acquir:11,activ:6,adapt:10,add:[9,10],add_constr:10,add_legend:10,add_north_arrow:10,add_obj:10,add_result:10,add_scal:10,add_to_legend:10,add_to_plot:10,add_var:10,addtion:[8,9,10],adjac:[1,8],adjacencylist:1,advanc:12,advanced_spaghetti_tutori:8,afford:10,ahuja:11,ai_sum:10,aij:10,algorithm:[10,11],all:[1,4,7,9],all_dist:1,allneighbordist:[1,10],along:[1,4,5,11],alpha:[8,9,10],alpha_shape_auto:10,alreadi:5,also:[1,7,10],alwai:[1,10],amo93:[1,11],anaconda:7,analysi:[1,6,10,11],analyt:[1,11],analytics_df:10,analytics_displai:10,analytics_matrix:10,analyz:11,anchor:10,ani:[1,8,9,10],anoth:1,anselin:11,api:6,appear:10,append:10,appli:10,applic:[10,11],appreci:6,approxim:1,ar14:[1,11],arc:[1,4,5],arc_length:[1,8],arcs200_df:8,arcs_df:[5,8,9],area:10,arg:9,argument:[1,9],aric:11,arrai:[1,10],arriba:11,arrow:10,art:11,articl:11,articul:1,arw:10,as_cmap:10,ask:10,assign:[1,10],associ:[1,5,10,11],assum:1,astyp:10,atsuyki:11,atsuyuki:11,attempt:10,attr:10,attribut:[1,4,8,10],attributeerror:10,august:11,author:[4,6,8,9,10],aux_to_plot:10,avail:1,averag:10,avoid:7,axarr:10,axes:[8,10],axessubplot:[8,10],axi:10,b978:11,background:10,background_gradi:10,barbaro:11,barth:11,barthelemy11:[1,11],base:[1,6,8,9,12],basic:[1,11,12],basic_spaghetti_tutori:9,bbox:10,bbox_prop:10,bbox_to_anchor:[9,10],beauguitt:11,becaus:1,been:[1,10],being:[1,5,8,10],bel:11,believ:[1,10],bennett:11,bergman:[10,11],best:8,between:[1,8,10],bf01386390:11,bibtex:6,binari:[1,2,3,8,10],blue:8,blueviolet:10,board:11,boe17:[1,11],boe:11,boiler:10,book:10,bool:[1,4,5,10],both:[1,5],bound:1,boxstyl:10,bridg:1,bring:10,british:11,budget:10,buff:10,buffer:10,bug:1,build:[6,8,10],build_:10,build_lscp:10,build_mclp:10,build_pcp:10,build_pmp:10,by_col:8,c_arrai:10,calc:10,calcul:[1,5],call:[1,8],can:[1,5,7,10],carlo:8,cbc_mixed_integer_program:10,cbo9781107415324:11,ccv:10,cdv:10,cdv_label:10,cell:10,center:11,central:[10,11],centric:1,ch3:11,ch5:11,ch6:11,ch81:[1,11],chain:1,chang:7,channel:7,channel_prior:7,chapter:11,charl:[6,10,11],chicago:11,chose:10,church1974:[],church:[10,11],cij:10,citat:[6,12],cite:[8,9,10],clang:[8,9,10],cli2fac:10,cli2iloc:10,cli2ncov:10,cli_df:10,cli_snp:10,cli_tru:10,cli_var:10,client_count:10,clients_snap:10,cliff:11,clone:7,close:[1,10],cmap:[9,10],col:10,col_nam:10,collect:10,color:[8,9,10],column:[1,5,9,10],colun:10,com:[6,7,8,9,10,11],combin:[1,9],command:7,committe:10,compar:[9,10],compenvurbsi:11,compil:[8,9,10],complet:10,complex:11,compon:1,compos:8,compris:1,comput:[1,2,8,11],compute_distance_to_vertic:1,compute_snap_dist:1,concav:10,concave_hul:10,conda:[8,9,10],conduct:1,confer:11,config:7,configur:10,connect:[1,11],connexion:11,consequ:1,constantin:11,constr:10,constrain:1,constraint:[10,11],construct:11,contain:[1,4,7],content:12,contigu:1,contiguityweight:[1,8],continu:10,contraint:10,contribut:7,control:1,convent:1,convert:[4,8,10],coord:[1,8,9],coordin:[1,4,8,10],coral:10,core:[1,8,9,10],corner:10,correct:1,corrupt:10,cost1_1:10,cost1_2:10,cost1_3:10,cost:1,cost_matrix:10,count:[1,10],count_per_link:[1,8],cov_count:10,cover:11,coverag:10,cpu:[8,9,10],cpython:[8,9,10],cr74:[11,12],creat:[1,3,7],create_patch:10,crime:[1,8],crimes_fil:1,crs:10,current:[1,3,7,8,10],custom:1,cyan:10,d2d_dist:1,daniel:11,darkcyan:10,darkgoldenrod:10,darkslategrai:10,darwin:[8,9,10],das13:[1,11],daskin:[10,11],data:[1,4,6,7],dataset:[1,10],david:[6,11],db14:[1,11],decid:10,decim:1,decis:10,declar:1,decompress:7,def:10,default_dict:4,defin:1,degre:1,demonstr:1,demostr:12,denni:11,densiti:10,depend:7,dependeci:[8,9,10],depth:1,deriv:8,descart:[9,10],descript:10,desir:[1,10],destin:[1,7,10],destpattern:[1,10],detail:[1,7],develop:6,diagon:1,dict:[1,4,8,10],dict_kei:1,dictionari:1,differ:8,digit:1,dij59:[1,11],dijkstra:11,dimens:10,dir:8,directli:1,directori:[1,3],discret:[10,11],discuss:1,disk:[1,2,3],displai:10,dist:[1,10],dist_snap:8,dist_to_vertex:[4,8],distanc:[1,4,8,11],distance_matrix:1,distancebandweight:1,distirbut:8,distribut:[1,7],divis:1,docsrc:[8,9,10],doe:5,doi:[6,11],dominiqu:11,done:8,download:7,dtype:[1,5],ducruet:11,due:10,duplic:1,duqu:11,dv_color:10,dv_colorset:10,dvs:10,dvs_to_leg:10,dynam:11,each:[1,4,10],econom:11,econometr:11,edg:[1,8,9],edge_length:1,edgecolor:10,edit:11,editor:11,effect:11,ei_sim:8,eiselt:11,either:[1,4,5],ejor:11,elco:11,element:[1,5,8,10],element_as_gdf:[8,9,10],elif:10,els:10,elsevi:11,emerg:[10,11],empti:10,encount:8,encyclopedia:11,end:1,englewood:11,ensur:7,entri:[6,9],enum_links_vertex:1,enumer:[1,8,10],environ:[7,11],epsg:10,equal:[1,10],equit:10,esda:[1,11],euclidean:1,european:11,event:6,everi:[8,10],exact:1,exactli:1,examin:5,exampl:[1,3,5,8,9],except:[5,10],exclud:[1,4,10],exist:[1,5],explan:10,explicityli:10,explor:[8,11],exportmodelaslpformat:10,extend:10,extra:10,extract:[1,5],extract_compon:1,extractgraph:1,f_arrai:10,fac2cli:10,fac2iloc:10,fac2selectcount:10,fac:10,fac_df:10,fac_snp:10,fac_tru:10,fac_var:10,facecolor:10,facil:[6,11,12],facilit:10,facilities_snap:10,facility_count:10,facility_loc:10,facilitylocationmodel:10,fals:[1,4,5,8,9,10],famili:10,fancybox:[9,10],fdv:10,fdv_label:10,feasibl:10,feet:1,fernand:11,fetch:1,field:4,fig:10,figsiz:[8,9,10],figur:[8,10],file:[1,2,3,10],filenam:[1,2,3],fill:[1,10],fill_diagon:1,filler:10,fillna:10,filterwarn:[8,10],find:1,first:[1,5],fix:1,flag:[1,4],flatten:10,fletcher:11,flow:[1,11],folch:[6,11],folder:7,follow:[1,6,7],folow:10,fontsiz:[8,9,10],fontstyl:10,fontweight:10,for_multiplot:10,forg:[7,9,10],fork:7,form:[1,4,8],format:10,formul:10,forth:10,foti:11,found:[8,9,10],four:10,framealpha:[9,10],framework:11,fran:11,franci:11,fre:[1,8],free:[7,10],freewai:11,from:[1,2,3,4,5,6,11],fuchsia:10,full:[1,3,8,10],full_distance_matrix:1,fulli:8,fundament:10,futur:4,fwl12:[1,11],gaboardi2018:6,gaboardi:[6,8,9,10,11],gean:11,gen_tre:1,gener:[1,4,9,11],geo:11,geocod:1,geoda:11,geodaspac:11,geodatafram:[1,4,5,10],geoff:11,geograph:[1,4,10,11],geographi:11,geojson:8,geom:10,geom_col:5,geometri:[5,9,10],geopanda:[1,4,5,10],geoseri:10,geospati:11,get_buff:10,get_fram:10,get_path:[1,3,5,8,9,10],get_xlim:10,get_ylim:10,getattr:10,gfh19:[1,11],git:7,github:[6,7],give:10,given:1,gmail:[8,9,10],going:10,graph:[1,10,11],graph_component2edg:1,graph_component_is_r:1,graph_component_label:1,graph_n_compon:1,gre:[1,8],greater:1,green:10,grow:10,guid:[6,11],hagberg:11,haggett:11,hak64:[11,12],hakimi1964:[],hakimi:[10,11],half:1,hall:11,handbook:11,handl:[9,10],has:[1,10],have:[1,7,8,10],head:10,heavi:10,help:[1,4],here:[1,6,7],higher:1,highlight:10,histogram:1,horner:11,household:10,how:[1,7,10],howev:[1,10],hspace:10,hss08:[1,11],http:[6,7,11],hull:10,human:11,i386:[8,9,10],id_col:5,idvari:[1,4],idx:[1,10],ies:10,ignor:[8,10],ijgi4020815:11,ikuho:11,iloc:10,implement:11,importerror:10,in_data:[1,4,8,9,10],inc:[10,11],incid:[1,4,8],includ:[1,4,8],inclus:6,increment:8,index:[1,10],indexerror:1,indic:[1,4,10],individu:10,infin:10,info:10,inform:[1,4,10,11],initi:[1,4],inlin:[8,9,10],innov:11,inplac:10,input:[1,4,10],instal:[6,8,9,10],instanc:[1,3],instanti:[1,5],int32:1,integ:[1,10],interact:[8,9,10],intern:11,interpattern:1,interpret:[8,9,10],intersect:10,intrapattern:1,introduc:10,intvar:10,invalid:8,invers:1,ipynb:[8,9,10],ipython:[8,9,10],isbn:11,isin:10,isinst:1,island:1,isol:1,ispr:11,ital:10,item:10,iter:[1,4,10],itm:11,its:[7,8,10],itself:1,ivar:10,jacqu:11,jai:6,jame:[6,8,9,10,11],januari:11,jarrod:11,jason:11,jgaboardi:[8,9,10],jlaura:1,joe:11,john:[6,10,11],journal:11,juli:11,julia:11,just:10,jvar:10,kang:[6,11],keep:1,keep_zero_dist:1,kegan:11,kei:[1,4,8,10],keiichi:11,keyerror:[5,10],keyword:[1,6,9],kitchin:11,know:1,kok:11,kokichi:11,koschinski:11,kre:[1,8],krut09:[1,11],kubi:11,kwarg:9,labb:11,labbept95:[1,11],label:[1,8,9,10],label_calc:10,lambda:10,larg:[8,9,10],larger:[8,10],latex:10,laura:[6,11],laurent:11,lavend:10,least:10,leav:10,left:[1,4,10],legend:[8,10],legend_aux:10,lemi:11,len:[1,8,10],length:[1,5,8,10],less:8,lesser:1,level:[1,10],levi:6,lfl:10,libpys:[1,3,4,5,8,9],librari:[6,10,11],light_palett:10,lightskyblu:10,like:[1,8],limegreen:10,line2d:[9,10],line:[5,9,10],linear:10,linear_solv:10,linestr:[5,10],linewidth:[8,10],link:[1,6,7],list:[1,4,8,10],listedcolormap:10,littl:10,load:[1,2],load_ext:[8,9,10],loadnetwork:1,loc:[5,8,10],local:[7,10],locat:[1,4,5,6,11,12],london:11,longleftarrow:10,longrightarrow:10,lookup:[1,4,10],loop:1,low:11,lower:[1,8,10],lowerbound:1,lowerenvelop:[1,8],lp_formul:10,lscp:10,ltd:11,luc:11,lumnitz:11,luxen:11,machin:[8,9,10],made:1,magnanti:11,mai:[1,4,8,10],mainten:10,make:7,malizia:11,manag:[7,11],mani:1,manner:10,map:10,marc:11,mark:11,markdown:10,marker:[9,10],markeredgecolor:10,markers:[8,9,10],martin:11,mask:1,match:10,mathematik:11,matplotlib:[8,10],matrix:1,max:10,max_coverag:10,maxim:11,maximum:[1,10],mclp:10,mdl:10,mean:[1,10],mean_dist:10,mean_mean:10,mean_std:10,measur:11,median:11,mediumseagreen:10,mediumvioletr:10,member:10,membership:10,mention:1,mere:10,messag:[8,10],meter:[8,10],method:[1,4,6,10,11],metropolitan:11,mhwang4:11,millisecond:10,millman:11,mimic:10,min:10,min_coverag:10,miniconda:7,minim:[7,10],minimum:[1,10],minut:10,misc:6,mline:[9,10],mlyon:11,mnsc:11,model:[1,11,12],model_nam:10,modern:11,modul:6,monkei:4,mont:8,month:6,moran:1,more:[1,10],most:[7,10],most_coverag:10,move:10,mpatch:10,mpsolver:10,ms1:10,ms2:10,msize:10,multi_plott:10,multipl:10,multiplot:10,must:[1,5,10],mynetwork:[1,3],n200:[1,8],n_cli:10,n_cli_uncov:10,n_fac:10,n_process:1,name:[1,5,10],nan:[1,10],navig:7,ncli:10,ncov2ncli:10,ncov:10,ndarrai:[1,4,10],nearest:[1,4,10,11],nearestneighbordist:1,need:8,neg:1,neighbor:[1,8,10,11],neighborhood:10,net:5,nethod:11,netvtx1:4,netvtx2:4,network:[4,5,11,12],network_component2arc:1,network_component_is_r:1,network_component_label:1,network_n_compon:1,network_tre:1,networkf:[1,8],networkg:[1,8],networkk:[1,8],networkx:[1,11],never:1,newli:[1,6],next:1,nigel:11,no_fac:10,node:[1,8,9],non:[1,10],non_articulation_point:1,non_obj_v:10,none:[1,4,5,10],north:10,note:[1,4,5,8,11],notebook:[8,9,10],notin:10,now:1,npoint:[1,4,8],npt:[1,8],nsnap:9,nstep:1,ntrue:9,ntw:[1,3,5,8,9,10],number:[1,4,8,10],numerisch:11,numpi:[1,4,8,10],numvar:10,obj:10,obj_val:10,object:[1,2,4,5],obs_id1:4,obs_id2:4,obs_idn:4,obs_on:1,obs_to_arc:[1,4,8],obs_to_edg:1,obs_to_vertex:[4,8],observ:[1,4],obtain:7,oct:6,ois:11,okab:11,okunuki:11,one:[1,10],onli:[1,7],onlin:[8,9,10],onto:1,oos06:[1,11],opaqu:8,open:[6,7,10,11],oper:[7,10,11],operations_research:10,opr:11,optim:[6,11,12],optimum:[10,11],option:1,ord:10,order:[5,10],ordereddict:10,org:11,orig_counts_per_link:8,origin:[1,4,6,10],orlin:11,os12a:[1,11],os12b:[1,11,12],os12c:[1,11,12],os12d:[1,11],osmnx:[1,11],osullivanu10:[1,11,12],other:[1,10],otherwis:1,out:[1,3],out_data:10,outcom:11,outsid:10,oxford:11,oy01:[1,11,12],p_facil:10,p_norm:8,p_rand:8,p_sim:8,p_z_sim:8,pad:10,page:[8,9,10,11],pahl:11,pair:4,panda:10,pandana:1,paper:[10,11],paramet:[1,2,3,4,5],part:[5,8,9,10,11],pasadena:11,pass:[1,10],patch:[4,10],path:[1,3,4,10],pattern:[1,4,5,11],paul:11,pcolor:10,pcp:10,pcp_sol:10,pdf:11,peachpuff:10,pedestrian:11,peeter:11,per:1,perc_serv:10,percent:10,percentag:10,perform:[1,8,10],permut:[1,8],person:10,philip:6,physic:11,physrep:11,pieter:11,pip:[7,10],pkl:[1,3],plabel:10,place:1,plan:10,pleas:[7,8,9,10],plot:8,plot_aux:10,plot_bas:10,plot_r:10,plotter:10,plt:[8,9,10],pmarker:10,pmp:10,png:10,point:[1,4,5,11],point_id:1,pointid:8,pointpattern:[1,5,8,9,10],poisson:1,polygon:10,popul:1,posit:1,post2:10,postiv:1,potenti:1,pp_name:[5,9,10],practic:11,pre:[1,2],precomput:8,predetermin:10,prefer:10,prentic:11,present:10,press:11,print:[8,9,10],print_result:10,print_sol:10,print_solut:10,problem:11,proceed:11,processor:[8,9,10],profession:11,professor:10,program:10,project:10,properti:[8,11],propos:6,provid:[1,6,10],proxi:10,prune:1,pseudo:10,psize:10,pt1_size:10,pt2_size:10,pt_str:1,pts_arrai:10,publish:10,pull:7,put:10,pyplot:[8,9,10],pysal:[4,6,7,11,12],python:[6,11],pywraplp:10,quantit:11,queri:1,r_cli:10,r_fac:10,ra07:[1,11],radiu:10,rais:[1,5,10],ral:[1,11],randint:10,random:1,random_pt:1,random_se:10,rang:10,rarrow:10,ravindra:11,raw:[1,5,8],re05:[11,12],read:[8,10],read_fil:10,readm:[8,9,10],reason:1,rebuild:1,reconstruct:1,record:[1,10],record_decis:10,red:8,refer:[1,6,8,9,10],regard:1,regener:8,region:[10,11],rei:[6,11],rel:8,relat:1,relationship:[10,11],releas:[8,9,10],release_900:[8,9,10],remaind:1,remedi:1,rememb:10,remov:1,replac:4,repo:7,report:11,repres:[1,10],represent:[1,6,10],request:[1,7],requir:[5,7,8,9,10],res:[1,8],res_to_plot:10,research:[8,9,10,11],reshap:10,resid:10,respect:10,result:1,retain:1,retina:10,revel:[10,11],revelle1970:[],revelle2005:[],revers:10,review:11,richard:11,right:[1,4],ring:1,rk19:[1,11],road:10,rob:11,robert:11,rotat:10,round:[1,10],rout:11,routledg:11,row:10,rrs:11,rs70:[11,12],run:7,russel:11,rwk:[1,11],s0927:11,s11067:11,s2d_dist:1,s2s_dist:1,saddlebrown:10,same:1,sampl:1,sanet:[1,11],sar:11,save:[1,2,3],save_fig:10,savefig:10,savenetwork:1,scale:[10,11],scatterpoint:9,scenario:1,schmidt:[6,11],scholasticahq:11,school:[1,8],schools_fil:1,schult:11,scienc:[7,10,11],scientif:6,scipi:11,scrime:9,seaborn:10,second:11,see:[1,4,10],seed:10,segm_counts_per_link:8,segment:[1,10],sei_norm:8,sei_rand:8,sei_sim:8,sel:10,select:7,selection_df:10,selection_displai:10,selection_matrix:10,selet:10,self:[1,2,3,4,10],semi:8,separ:7,sergio:[6,11],serv:10,serv_label:10,servic:[10,11],service_area:10,set:[1,5,7,8,9],set_aspect:10,set_capt:10,set_facecolor:10,set_matplotlib_format:10,set_titl:10,seth:11,shape:[1,5,10],shapefil:[1,4,8,10],sharei:10,sharex:10,she:10,shell:7,shino:11,shiod:11,shortest:1,should:[1,3,8,10],show:[1,8],shown:1,shp:[1,3,5,10],signatur:[1,4],signific:1,sij:10,sim:[1,8],sim_pt:10,simplifi:[1,4],simul:1,simulate_observ:[1,8],simulated_geo_point:10,simulated_points_al:10,simulated_points_list:10,simulatedpointpattern:1,sinc:[8,10],singl:[1,4,8,10],site:10,size:10,skip:1,slightli:10,small:8,smoother:10,snap:[1,4,5],snap_dist:[1,4],snapobserv:[1,8,9,10],snapped_coordin:[4,8,9],snapped_crimes_df:9,snapped_schools_df:9,snkit:[1,11],softwar:1,solution_valu:10,solve_minut:10,solver:10,solver_inst:10,son:[10,11],sort:[1,10],sourc:[1,2,3,4,5,6,7],sourcepattern:[1,10],space:10,spacer:10,spaghetti:12,spatial:[1,11],specif:[1,4,7,10],specifi:[1,10],split:[1,10],split_arc:[1,8],split_network:1,squeez:10,sschool:9,standard:1,stastist:10,stat:10,state:11,std:10,stdout:10,step:[1,10],stephen:[6,11],still:[1,8],stipul:10,store:[1,4],str:[1,2,3,4,5,10],strbuff:10,street:[1,3,5,8,9,11],streets_buff:10,streets_fil:1,strict:7,string:1,structur:[10,11],stub:4,studi:11,style:10,styler:10,styliz:10,submit:7,subplot:10,subplots_adjust:10,subset:10,sugihara:11,sullivan:11,sum:[1,5,8,10],supplement:10,suppli:8,support:[7,10],suptitl:10,sure:7,survei:11,sussex:11,swain:[10,11],swart:11,swig:10,symbol:10,synthesi:11,sys:10,system:[7,8,9,10,11],tab20:9,tag:[4,8,9,10],tansel:11,tar:7,tb00448:11,tb00902:11,tcc:11,tcrime:9,term:1,text:10,tfl83:[1,11],than:[1,10],them:[1,10],theoret:[1,6,8],theori:[1,6,11],therefor:10,thi:[1,3,4,5,7,9],thiss:11,thistl:10,thoma:11,those:4,thought:1,threshold:1,thrift:11,through:[1,6,7,8,9],tiernei:11,time:[10,11],timothi:11,titl:[6,8,10],to_cr:10,to_fil:10,tolist:10,tom:11,tomalrussel:11,toolbox:11,top:[1,10],topolog:[8,11],torega:[10,11],toregas1971:[],toregas1972:[],total:[1,5,10],total_bound:10,toward:10,tr72:[11,12],translat:10,transpar:10,transport:11,travel:[10,11],travi:11,tree:1,tree_nearest:1,true_crimes_df:9,true_schools_df:9,truncat:1,tschool:9,tsrb71:[11,12],tupl:[1,4,10],turn:10,tutori:6,two:[1,4,11],type:[1,4,10],typeerror:10,unary_union:10,uncov:10,under:[6,10,11],understand:8,unforseen:10,uniform:[1,8,10],union:10,uniqu:1,unique_arc:1,unit:[1,10],univers:10,unless:1,unseg:8,unselect:10,unwin:11,upchurch:11,updat:[9,10],upper:[1,8,10],upperbound:1,upperenvelop:8,urban:11,url:[6,11],usa:11,usag:6,use:[4,6],use_cas:10,used:[1,4,8,9,10],user:8,using:[1,6,7,11],usr_warn:10,util:1,valid:1,valu:[1,4,8,10],valueerror:10,var_index:10,vari:10,variabl:[1,4,10],varoquaux:11,vaught:11,vector:[1,8,10],version:[8,9,10],vertex:[1,5,8],vertex_coord:[1,8],vertex_list:1,vertex_sig:1,vertic:[1,4,5],vertices200_df:8,vertices_df:[5,8,9],vi_norm:8,vi_rand:8,vi_sim:8,view:[10,11],visual:[10,11],volum:11,volunt:10,vstack:10,vtx0:1,vtx1:1,w_compon:1,w_graph:1,w_network:1,waddel:11,walk:[8,9],walltim:10,warn:[7,8,10],watermark:[8,9,10],web16:[1,11],weber:11,wei:6,weight:1,wenwen:11,west:11,when:[1,4,5,7,10],where:[1,2,3,10],whether:[1,4],which:[1,8],white:10,wilei:[10,11],within:[1,4,5,10],without:1,wolf:[6,11],worst:10,would:[1,6],wriglei:11,write:10,write_lp:10,wspace:10,x1_1:10,x1_2:10,x1_3:10,x2_1:10,x3_1:10,x86_64:[8,9,10],xaxi:8,xun:11,yamada:11,year:6,york:10,you:[6,7],your:[7,8,9,10],z2ss:8,z_norm:8,z_rand:8,z_sim:8,zenodo:[6,11],zero:[1,8,10],zorder:[9,10]},titles:["API reference","spaghetti.Network","spaghetti.Network.loadnetwork","spaghetti.Network.savenetwork","spaghetti.PointPattern","spaghetti.element_as_gdf","spaghetti","Installation","Advanced pysal.spaghetti tutorial","Basic pysal.spaghetti tutorial","Demostrating network-based optimal facility location modeling","References","Tutorial"],titleterms:{"case":8,"class":10,"function":[8,10],"true":9,abov:10,advanc:8,all:10,alloc:[8,9],alpha_shap:10,analysi:8,analyt:10,analyz:10,api:0,arc:[8,9],attribut:9,base:10,basic:9,best:10,calcul:[8,10],candid:10,cbc:10,center:10,cite:6,client:10,cluster:8,commun:10,comparis:10,comparison:9,conda:7,constrain:8,coordin:9,cost:10,count:8,cover:10,creat:[8,9,10],crime:9,data:10,datafram:10,defin:10,demand:10,demonstr:8,demostr:10,develop:7,digit:8,distanc:10,element_as_gdf:5,empir:10,empric:10,esda:8,exampl:10,extract:[0,8],facil:10,featur:0,feedstock:7,feet:8,fetch:10,file:[8,9],from:[8,9,10],gener:[8,10],geodatafram:[8,9],geopanda:[8,9],graph:[6,8],highli:7,hous:10,index:7,infer:6,instal:7,instanc:10,instanti:[0,8,9,10],instead:8,integr:10,intens:8,lai:10,legend:9,libpys:10,link:8,load:0,loadnetwork:2,locat:[9,10],matplotlib:9,matrix:10,maxim:10,median:10,minimax:10,model:10,moran:8,need:10,network:[0,1,2,3,6,8,9,10],nework:10,object:[8,9,10],observ:[8,9],optim:10,origin:9,ortool:10,out:10,packag:7,paramet:10,patch:9,pattern:8,per:[8,10],plot:[9,10],point:[8,9,10],pointpattern:4,problem:10,pysal:[8,9,10],python:7,random:10,randomli:10,recommend:[7,10],refer:[0,11],represent:8,result:10,save:0,savenetwork:3,scenario:10,school:9,segment:8,select:10,set:10,shp:[8,9],simul:8,snap:[8,9,10],solut:10,solv:10,spaghetti:[1,2,3,4,5,6,7,8,9,10],spatial:[6,8,10],split:8,street:10,suit:10,synthet:10,test:8,thi:[8,10],think:10,topolog:6,tutori:[8,9,12],use:10,using:8,util:10,version:7,vertic:[8,9],via:7,visual:[8,9],weight:10,which:10,without:9,would:10,you:10}}) \ No newline at end of file diff --git a/docsrc/_static/references.bib b/docsrc/_static/references.bib index 46771b2c..f520770f 100644 --- a/docsrc/_static/references.bib +++ b/docsrc/_static/references.bib @@ -379,3 +379,13 @@ @article{ReVelle2005 volume = {165}, year = {2005} } + +@misc{tom_russell_2019_3379659, + author = {Tom Russell and Elco Koks}, + title = {{tomalrussell/snkit: v1.6.0}}, + month = aug, + year = {2019}, + publisher = {Zenodo}, + version = {v1.6.0}, + doi = {10.5281/zenodo.3379659} + } \ No newline at end of file diff --git a/spaghetti/network.py b/spaghetti/network.py index bfaf179b..d89b7506 100644 --- a/spaghetti/network.py +++ b/spaghetti/network.py @@ -29,9 +29,11 @@ class Network: Parameters ---------- - in_data : {geopandas.GeoDataFrame, str} + in_data : {str, list, tuple, numpy.ndarray, libpysal.cg.Chain, geopandas.GeoDataFrame} The input geographic data. Either (1) a path to a shapefile - (str); or (2) a ``geopandas.GeoDataFrame``. + (str); (2) an iterable containing ``libpysal.cg.Chain`` + objects; (3) a single ``libpysal.cg.Chain``; or + (4) a ``geopandas.GeoDataFrame``. vertex_sig : int Round the x and y coordinates of all vertices to ``vertex_sig`` @@ -149,6 +151,7 @@ class Network: :cite:`Ducruet2014`, :cite:`Weber2016`, for more in-depth discussion on spatial networks, graph theory, and location along networks. For related network-centric software see + `Snkit `_ :cite:`tom_russell_2019_3379659`, `SANET `_ :cite:`Okabe2006a`, `NetworkX `_ :cite:`Hagberg2008`, `Pandana `_ :cite:`Foti2012`, @@ -399,27 +402,48 @@ def extract_components(self, w, graph=False): setattr(self, obj_type + attr_str, attr) def _extractnetwork(self): - """Used internally to extract a network from a polyline - shapefile of a ``geopandas.GeoDataFrame``. + """Used internally to extract a network. """ # initialize vertex count vertex_count = 0 - # determine if input network data is coming from - # shapefile or a geopandas.GeoDataFrame - if isinstance(self.in_data, str): + # determine input network data type + in_dtype = str(type(self.in_data)).split("'")[1] + is_libpysal_chains = False + supported_iterables = ["list", "tuple", "numpy.ndarray"] + # type error message + msg = "'%s' not supported for point pattern instantiation." + + # set appropriate geometries + if in_dtype == "str": shps = open(self.in_data) - else: + elif in_dtype in supported_iterables: + shps = self.in_data + shp_type = str(type(shps[0])).split("'")[1] + if shp_type == "libpysal.cg.shapes.Chain": + is_libpysal_chains = True + else: + raise TypeError(msg % shp_type) + elif in_dtype == "libpysal.cg.shapes.Chain": + shps = [self.in_data] + is_libpysal_chains = True + elif in_dtype == "geopandas.geodataframe.GeoDataFrame": shps = self.in_data.geometry + else: + raise TypeError(msg % in_dtype) # iterate over each record of the network lines for shp in shps: - # fetch all vertices between euclidean segments - # in the line record -- these vertices are - # coordinates in an (x, y) tuple. - vertices = weights._contW_lists._get_verts(shp) + # if the segments are native pysal geometries + if is_libpysal_chains: + vertices = shp.vertices + else: + # fetch all vertices between euclidean segments + # in the line record -- these vertices are + # coordinates in an (x, y) tuple. + vertices = weights._contW_lists._get_verts(shp) # iterate over each vertex (v) for i, v in enumerate(vertices[:-1]): @@ -863,7 +887,6 @@ def contiguityweights(self, graph=True, weightings=None): # for each network link (2) for neigh in links: - # skip if comparing link to itself if key == neigh: continue @@ -888,6 +911,9 @@ def contiguityweights(self, graph=True, weightings=None): if key[1] > neigh[1]: working = False + if len(links) == 1: + working = False + # call libpysal for `W` instance w = weights.W(neighbors, weights=_weights) @@ -2707,9 +2733,11 @@ class PointPattern: Parameters ---------- - in_data : {geopandas.GeoDataFrame, str} + in_data : {str, list, tuple, numpy.ndarray, libpysal.cg.Point, geopandas.GeoDataFrame} The input geographic data. Either (1) a path to a shapefile - ``str``; or (2) a ``geopandas.GeoDataFrame``. + (str); (2) an iterable containing ``libpysal.cg.Point`` + objects; (3) a single ``libpysal.cg.Point``; or + (4) a ``geopandas.GeoDataFrame``. idvariable : str Field in the shapefile to use as an ID variable. @@ -2765,27 +2793,51 @@ def __init__(self, in_data=None, idvariable=None, attribute=False): self.points = {} self.npoints = 0 + # determine input point data type + in_dtype = str(type(in_data)).split("'")[1] # flag for points from a shapefile - if isinstance(in_data, str): + from_shp = False + # flag for points as libpysal.cg.Point objects + is_libpysal_points = False + supported_iterables = ["list", "tuple", "numpy.ndarray"] + # type error message + msg = "'%s' not supported for point pattern instantiation." + + # set appropriate geometries + if in_dtype == "str": from_shp = True - else: + elif in_dtype in supported_iterables: + dtype = str(type(in_data[0])).split("'")[1] + if dtype == "libpysal.cg.shapes.Point": + is_libpysal_points = True + else: + raise TypeError(msg % dtype) + elif in_dtype == "libpysal.cg.shapes.Point": + in_data = [in_data] + is_libpysal_points = True + elif in_dtype == "geopandas.geodataframe.GeoDataFrame": from_shp = False + else: + raise TypeError(msg % in_dtype) # either set native point ID from dataset or create new IDs - if idvariable: + if idvariable and not is_libpysal_points: ids = weights.util.get_ids(in_data, idvariable) else: ids = None # extract the point geometries - if from_shp: - pts = open(in_data) + if not is_libpysal_points: + if from_shp: + pts = open(in_data) + else: + pts_objs = list(in_data.geometry) + pts = [cg.shapes.Point((p.x, p.y)) for p in pts_objs] else: - pts_objs = list(in_data.geometry) - pts = [cg.shapes.Point((p.x, p.y)) for p in pts_objs] + pts = in_data # fetch attributes if requested - if attribute: + if attribute and not is_libpysal_points: # open the database file if data is from shapefile if from_shp: diff --git a/spaghetti/tests/test_network.py b/spaghetti/tests/test_network.py index 6c645b65..69c04efc 100644 --- a/spaghetti/tests/test_network.py +++ b/spaghetti/tests/test_network.py @@ -24,6 +24,14 @@ def setUp(self): ) self.n_known_arcs, self.n_known_vertices = 303, 230 + # native pysal geometries + self.chains = chains = [ + cg.Chain( + [cg.Point(self.ntw_from_shp.vertex_coords[vertex]) for vertex in arc] + ) + for arc in self.ntw_from_shp.arcs + ] + def tearDown(self): pass @@ -39,6 +47,30 @@ def test_network_data_read(self): self.assertIn(0, self.ntw_from_shp.adjacencylist[2]) self.assertNotIn(0, self.ntw_from_shp.adjacencylist[3]) + def test_network_from_libpysal_chains(self): + known_components = self.ntw_from_shp.network_n_components + known_length = sum(self.ntw_from_shp.arc_lengths.values()) + # network instantiated from libpysal.cg.Chain objects + self.ntw_from_chains = spaghetti.Network(in_data=self.chains) + self.assertEqual(self.ntw_from_chains.network_n_components, known_components) + self.assertAlmostEqual( + sum(self.ntw_from_chains.arc_lengths.values()), known_length, places=3 + ) + + def test_network_from_single_libpysal_chain(self): + # network instantiated from a single libpysal.cg.Chain + chain = cg.Chain([cg.Point((1, 1)), cg.Point((2, 2))]) + self.ntw_from_chain = spaghetti.Network(in_data=chain) + self.assertEqual(self.ntw_from_chain.arcs, self.ntw_from_chain.edges) + + def test_network_failures(self): + # try instantiating network with single point + with self.assertRaises(TypeError): + spaghetti.Network(in_data=cg.Point((0, 0))) + # try instantiating network with list of single point + with self.assertRaises(TypeError): + spaghetti.Network(in_data=[cg.Point((0, 0))]) + @unittest.skipIf(GEOPANDAS_EXTINCT, "Missing Geopandas") def test_network_from_geopandas(self): # network instantiated from geodataframe @@ -145,6 +177,37 @@ def setUp(self): def tearDown(self): pass + def test_pp_from_libpysal_points(self): + # known + crimes = self.ntw.pointpatterns["crimes"] + known_snapped = set(crimes.snapped_coordinates.values()) + # points from pysal geometries + points = [cg.Point(crimes.points[i]["coordinates"]) for i in crimes.points] + self.ntw.snapobservations(points, "cg_crimes") + observed = self.ntw.pointpatterns["cg_crimes"] + observed_snapped = set(observed.snapped_coordinates.values()) + self.assertEqual(observed_snapped, known_snapped) + + def test_pp_from_single_libpysal_point(self): + # network instantiated from a single libpysal.cg.Chain + chain = cg.Chain([cg.Point((1, 1)), cg.Point((2, 2))]) + known_dist = 1.4142135623730951 + self.ntw_from_chain = spaghetti.Network(in_data=chain) + self.ntw_from_chain.snapobservations(cg.Point((0, 0)), "synth_obs") + snap_dist = self.ntw_from_chain.pointpatterns["synth_obs"].dist_snapped[0] + self.assertAlmostEqual(snap_dist, known_dist, places=10) + + def test_pp_failures(self): + # network instantiated from a single libpysal.cg.Chain + chain = cg.Chain([cg.Point((1, 1)), cg.Point((2, 2))]) + self.ntw_from_chain = spaghetti.Network(in_data=chain) + # try snapping chain + with self.assertRaises(TypeError): + self.ntw_from_chain.snapobservations(chain, "chain") + # try snapping list of chain + with self.assertRaises(TypeError): + self.ntw_from_chain.snapobservations([chain], "chain") + @unittest.skipIf(GEOPANDAS_EXTINCT, "Missing Geopandas") def test_pp_from_geopandas(self): self.gdf_pp1_str = "schools" diff --git a/spaghetti/tests/test_network_api.py b/spaghetti/tests/test_network_api.py index aa62d33c..1367168e 100644 --- a/spaghetti/tests/test_network_api.py +++ b/spaghetti/tests/test_network_api.py @@ -23,6 +23,14 @@ def setUp(self): ) self.n_known_arcs, self.n_known_vertices = 303, 230 + # native pysal geometries + self.chains = chains = [ + cg.Chain( + [cg.Point(self.ntw_from_shp.vertex_coords[vertex]) for vertex in arc] + ) + for arc in self.ntw_from_shp.arcs + ] + def tearDown(self): pass @@ -38,6 +46,30 @@ def test_network_data_read(self): self.assertIn(0, self.ntw_from_shp.adjacencylist[2]) self.assertNotIn(0, self.ntw_from_shp.adjacencylist[3]) + def test_network_from_libpysal_chains(self): + known_components = self.ntw_from_shp.network_n_components + known_length = sum(self.ntw_from_shp.arc_lengths.values()) + # network instantiated from libpysal.cg.Chain objects + self.ntw_from_chains = spaghetti.Network(in_data=self.chains) + self.assertEqual(self.ntw_from_chains.network_n_components, known_components) + self.assertAlmostEqual( + sum(self.ntw_from_chains.arc_lengths.values()), known_length, places=3 + ) + + def test_network_from_single_libpysal_chain(self): + # network instantiated from a single libpysal.cg.Chain + chain = cg.Chain([cg.Point((1, 1)), cg.Point((2, 2))]) + self.ntw_from_chain = spaghetti.Network(in_data=chain) + self.assertEqual(self.ntw_from_chain.arcs, self.ntw_from_chain.edges) + + def test_network_failures(self): + # try instantiating network with single point + with self.assertRaises(TypeError): + spaghetti.Network(in_data=cg.Point((0, 0))) + # try instantiating network with list of single point + with self.assertRaises(TypeError): + spaghetti.Network(in_data=[cg.Point((0, 0))]) + @unittest.skipIf(GEOPANDAS_EXTINCT, "Missing Geopandas") def test_network_from_geopandas(self): # network instantiated from geodataframe @@ -144,6 +176,37 @@ def setUp(self): def tearDown(self): pass + def test_pp_from_libpysal_points(self): + # known + crimes = self.ntw.pointpatterns["crimes"] + known_snapped = set(crimes.snapped_coordinates.values()) + # points from pysal geometries + points = [cg.Point(crimes.points[i]["coordinates"]) for i in crimes.points] + self.ntw.snapobservations(points, "cg_crimes") + observed = self.ntw.pointpatterns["cg_crimes"] + observed_snapped = set(observed.snapped_coordinates.values()) + self.assertEqual(observed_snapped, known_snapped) + + def test_pp_from_single_libpysal_point(self): + # network instantiated from a single libpysal.cg.Chain + chain = cg.Chain([cg.Point((1, 1)), cg.Point((2, 2))]) + known_dist = 1.4142135623730951 + self.ntw_from_chain = spaghetti.Network(in_data=chain) + self.ntw_from_chain.snapobservations(cg.Point((0, 0)), "synth_obs") + snap_dist = self.ntw_from_chain.pointpatterns["synth_obs"].dist_snapped[0] + self.assertAlmostEqual(snap_dist, known_dist, places=10) + + def test_pp_failures(self): + # network instantiated from a single libpysal.cg.Chain + chain = cg.Chain([cg.Point((1, 1)), cg.Point((2, 2))]) + self.ntw_from_chain = spaghetti.Network(in_data=chain) + # try snapping chain + with self.assertRaises(TypeError): + self.ntw_from_chain.snapobservations(chain, "chain") + # try snapping list of chain + with self.assertRaises(TypeError): + self.ntw_from_chain.snapobservations([chain], "chain") + @unittest.skipIf(GEOPANDAS_EXTINCT, "Missing Geopandas") def test_pp_from_geopandas(self): self.gdf_pp1_str = "schools"