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: numpy.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
- __init__(datapoints: numpy.ndarray, tree_finder: Callable[[networkx.Graph], networkx.Graph] = networkx.minimum_spanning_tree)
- Parameters
datapoints –
tree_finder – function mapping a graph to a subgraph. The default is minimum_spanning_tree
- total_weight()
- num_edges()
- mean_edge_weight()
- summary_dict() Dict[str, float]
Dictionary containing coarse information about the tree
- class CoordinateSpanningTree(datapoints: numpy.ndarray, tree_finder: Callable[[networkx.Graph], networkx.Graph] = networkx.minimum_spanning_tree)[source]
Bases:
sensai.geoanalytics.geopandas.graph.SpanningTree
,sensai.geoanalytics.geopandas.coordinates.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.- __init__(datapoints: numpy.ndarray, tree_finder: Callable[[networkx.Graph], networkx.Graph] = networkx.minimum_spanning_tree)
- Parameters
datapoints –
tree_finder – function mapping a graph to a subgraph. The default is minimum_spanning_tree
- multi_line_string()
- to_geodf(crs='epsg:3857')
- Parameters
crs – projection. By default pseudo-mercator
- Returns
GeoDataFrame of length 1 with the tree as MultiLineString instance