graph#


delaunay_graph(data: ~numpy.ndarray, edge_weight: ~typing.Callable[[~numpy.ndarray, ~numpy.ndarray], float] = <function euclidean>)[source]#

The Delaunay triangulation of the data as networkx.Graph

Parameters:
  • data

  • edge_weight – function to compute weight given two coordinate points

Returns:

instance of networx.Graph where the edges contain additional datapoints entries for “weight” and for constants.COORDINATE_PAIR_KEY

class SpanningTree(datapoints: ndarray, tree_finder: Callable[[networkx.Graph], networkx.Graph] = networkx.minimum_spanning_tree)[source]#

Bases: object

Wrapper around a tree-finding algorithm that will be applied on the Delaunay graph of the datapoints

Parameters:
  • datapoints

  • tree_finder – function mapping a graph to a subgraph. The default is minimum_spanning_tree

total_weight()[source]#
num_edges()[source]#
mean_edge_weight()[source]#
summary_dict() Dict[str, float][source]#

Dictionary containing coarse information about the tree

class CoordinateSpanningTree(datapoints: ndarray, tree_finder: Callable[[networkx.Graph], networkx.Graph] = networkx.minimum_spanning_tree)[source]#

Bases: SpanningTree, GeoDataFrameWrapper

Wrapper around a tree-finding algorithm that will be applied on the Delaunay graph of the coordinates. Enhances the SpanningTree class by adding methods and validation specific to geospatial coordinates.

Parameters:
  • datapoints

  • tree_finder – function mapping a graph to a subgraph. The default is minimum_spanning_tree

multi_line_string()[source]#
to_geodf(crs='epsg:3857')[source]#
Parameters:

crs – projection. By default pseudo-mercator

Returns:

GeoDataFrame of length 1 with the tree as MultiLineString instance