pysal.explore.spaghetti.
Network
(in_data=None, node_sig=11, unique_segs=True, extractgraph=True)[source]¶Spatiallyconstrained network representation and analytical functionality.
Parameters: 


Examples
Instantiate an instance of a network.
>>> import pysal.explore.spaghetti as spgh
>>> streets_file = examples.get_path('streets.shp')
>>> ntw = spgh.Network(in_data=streets_file)
Snap point observations to the network with attribute information.
>>> crimes_file = examples.get_path('crimes.shp')
>>> ntw.snapobservations(crimes_file, 'crimes', attribute=True)
And without attribute information.
>>> schools_file = examples.get_path('schools.shp')
>>> ntw.snapobservations(schools_file, 'schools', attribute=False)
Attributes: 


Methods
NetworkF (pointpattern[, nsteps, …]) 
Computes a network constrained FFunction 
NetworkG (pointpattern[, nsteps, …]) 
Computes a network constrained GFunction 
NetworkK (pointpattern[, nsteps, …]) 
Computes a network constrained KFunction 
allneighbordistances (sourcepattern[, …]) 
Compute either all distances between i and j in a single point pattern or all distances between each i from a source pattern and all j from a destination pattern. 
compute_distance_to_nodes (x, y, edge) 
Given an observation on a network edge, return the distance to the two nodes that bound that end. 
compute_snap_dist (pattern, idx) 
Given an observation snapped to a network edge, calculate the distance from the original location to the snapped location. 
contiguityweights ([graph, weightings]) 
Create a contiguity based W object. 
count_per_edge (obs_on_network[, graph]) 
Compute the counts per edge. 
distancebandweights (threshold[, n_proccess, …]) 
Create distance based weights. 
enum_links_node (v0) 
Returns the edges (links) around node. 
extractgraph () 
Using the existing network representation, create a graphtheoretic representation by removing all nodes with a neighbor incidence of two (nonarticulation points). 
loadnetwork (filename) 
Load a network from a binary file saved on disk. 
nearestneighbordistances (sourcepattern[, …]) 
Compute the interpattern nearest neighbor distances or the intrapattern nearest neighbor distances between a source pattern and a destination pattern. 
node_distance_matrix (n_processes[, gen_tree]) 
Called from within allneighbordistances(), nearestneighbordistances(), and distancebandweights(). 
savenetwork (filename) 
Save a network to disk as a binary file. 
segment_edges (distance) 
Segment all of the edges in the network at either a 
simulate_observations (count[, distribution]) 
Generate a simulated point pattern on the network. 
snapobservations (in_data, name[, …]) 
Snap a point pattern shapefile to this network object. 
Methods
NetworkF (pointpattern[, nsteps, …]) 
Computes a network constrained FFunction 
NetworkG (pointpattern[, nsteps, …]) 
Computes a network constrained GFunction 
NetworkK (pointpattern[, nsteps, …]) 
Computes a network constrained KFunction 
__init__ ([in_data, node_sig, unique_segs, …]) 

allneighbordistances (sourcepattern[, …]) 
Compute either all distances between i and j in a single point pattern or all distances between each i from a source pattern and all j from a destination pattern. 
compute_distance_to_nodes (x, y, edge) 
Given an observation on a network edge, return the distance to the two nodes that bound that end. 
compute_snap_dist (pattern, idx) 
Given an observation snapped to a network edge, calculate the distance from the original location to the snapped location. 
contiguityweights ([graph, weightings]) 
Create a contiguity based W object. 
count_per_edge (obs_on_network[, graph]) 
Compute the counts per edge. 
distancebandweights (threshold[, n_proccess, …]) 
Create distance based weights. 
enum_links_node (v0) 
Returns the edges (links) around node. 
extractgraph () 
Using the existing network representation, create a graphtheoretic representation by removing all nodes with a neighbor incidence of two (nonarticulation points). 
loadnetwork (filename) 
Load a network from a binary file saved on disk. 
nearestneighbordistances (sourcepattern[, …]) 
Compute the interpattern nearest neighbor distances or the intrapattern nearest neighbor distances between a source pattern and a destination pattern. 
node_distance_matrix (n_processes[, gen_tree]) 
Called from within allneighbordistances(), nearestneighbordistances(), and distancebandweights(). 
savenetwork (filename) 
Save a network to disk as a binary file. 
segment_edges (distance) 
Segment all of the edges in the network at either a 
simulate_observations (count[, distribution]) 
Generate a simulated point pattern on the network. 
snapobservations (in_data, name[, …]) 
Snap a point pattern shapefile to this network object. 