API reference

spaghetti.Network

spaghetti.Network.extract_components(w[, graph]) Extract connected component information from a libpysal.weights.weights.W object
spaghetti.Network.extractgraph() Using the existing network representation, create a graph-theoretic representation by removing all vertices with a neighbor incidence of two (non-articulation points).
spaghetti.Network.contiguityweights([graph, …]) Create a contiguity-based libpysal W object.
spaghetti.Network.distancebandweights(threshold) Create distance based weights.
spaghetti.Network.snapobservations(in_data, name) Snap a point pattern shapefile to network object.
spaghetti.Network.compute_distance_to_vertices(x, …) Given an observation on a network arc, return the distance to the two vertices that bound that end.
spaghetti.Network.compute_snap_dist(pattern, idx) Given an observation snapped to a network arc, calculate the distance from the original location to the snapped location.
spaghetti.Network.count_per_link(obs_on[, graph]) Compute the counts per arc or edge (link).
spaghetti.Network.simulate_observations(count) Generate a simulated point pattern on the network.
spaghetti.Network.enum_links_vertex(v0) Returns the arcs (links) around vertices.
spaghetti.Network.full_distance_matrix(…) All vertex-to-vertex distances on a network.
spaghetti.Network.allneighbordistances(…) 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.
spaghetti.Network.nearestneighbordistances(…) Compute the interpattern nearest neighbor distances or the intrapattern nearest neighbor distances between a source pattern and a destination pattern.
spaghetti.Network.split_arcs(distance) Split all of the arcs in the network at either a
spaghetti.Network.savenetwork(filename) Save a network to disk as a binary file.
spaghetti.Network.loadnetwork(filename) Load a network from a binary file saved on disk.
spaghetti.Network.NetworkF(pointpattern[, …]) Computes a network constrained F-Function
spaghetti.Network.NetworkG(pointpattern[, …]) Computes a network constrained G-Function
spaghetti.Network.NetworkK(pointpattern[, …]) Computes a network constrained K-Function
spaghetti.Network._evaluate_napts(napts, …) Evaluate one connected component in a network for non-articulation points (napts) and return an updated set of napts and unvisted vertices.
spaghetti.Network._extractnetwork() Used internally to extract a network from a polyline shapefile of a geopandas.GeoDataFrame.
spaghetti.Network._newpoint_coords(arc, distance) Used internally to compute new point coordinates during snapping.
spaghetti.Network._round_sig(v) Used internally to round the vertex to a set number of significant digits.
spaghetti.Network._snap_to_link(pointpattern) Used internally to snap point observations to network arcs.
spaghetti.Network._yield_napts() Find all nodes with degree 2 that are not in an isolated island ring (loop) component.
spaghetti.Network._yieldneighbor(vtx, …) Used internally, this method traverses a bridge arc to find the source and destination nodes.

spaghetti.PointPattern

spaghetti.PointPattern([in_data, …]) A stub point pattern class used to store a point pattern.

spaghetti.SimulatedPointPattern

spaghetti.SimulatedPointPattern() Struct style class to mirror the PointPattern class.

spaghetti

spaghetti.element_as_gdf(net[, vertices, …]) Return a geopandas.GeoDataFrame of network elements.This can be (a) the vertices of a network; (b) the arcs of a network; (c) both the vertices and arcs of the network; (d) raw point pattern associated with the network; or (e) snapped point pattern of (d)..