iduedu.graph_stats¶
- iduedu.graph_stats(urban_graph, *, area=None, zones=None, edge_types=None, boundary_buffer=1.0, precision=0.01)[source]¶
Measures of size, density, shape and connectivity of a street network.
Without
areaandzonesthe whole graph is measured. Withareaonly the part of the graph inside it is measured, and withzonesevery zone separately. In both cases the number of streets at a node is taken from the whole graph, so a graph built with a margin around the study area gives dead ends and intersections free of edge effects. Nodes belong to the zone they lie in, streets and segments to the zone of their midpoint.Measures (
NaNwhere a measure is undefined):node_count,edge_count(edges as stored),street_count(undirected streets);street_length_total(metres, every physical segment once),street_length_mean;streets_per_node_mean,dead_end_count,dead_end_share,intersection_count(nodes with three or more streets),intersection_4way_share(four or more streets, among intersections);circuity_mean(street length over the straight distance between its ends, loops left out),self_loop_share,parallel_street_share;component_count,largest_component_share(of nodes);beta_index(streets per node),gamma_index(streets over the most a planar graph can have,3 (v - 2)),cyclomatic_number(independent cycles,e - v + p),meshedness(cycles over the most a planar graph can have,2 v - 5); they count streets with both ends inside;orientation_entropy(Shannon entropy in nats of segment bearings in 36 bins, weighted by length) andorientation_order(1 for a perfect grid, 0 for uniform bearings);oneway_share(of street length) when the graph has a direction column;speed_mean_kmh(total length over total travel time) when edges havelength_meterandtime_min;elevation_min,elevation_max,elevation_mean(nodes),grade_mean(mean absolute grade weighted by length) andgrade_maxwhen the graph carries elevation (add_elevation());platform_count(nodes of typeplatform),unattached_platform_count(platforms no walking edge leads to, in graphs that have walking edges) andboarding_edge_countfor graphs with public-transport platforms;with
areaorzones:area_km2,node_density,intersection_density(per km²) andstreet_density(km per km²).
- Parameters:
urban_graph (
UrbanGraph) – Graph in a projected (metric) CRS.area (
BaseGeometry|GeoSeries|GeoDataFrame|None) – Study area: a shapely geometry in EPSG:4326, asterritoryof the graph builders, or a GeoSeries / GeoDataFrame in any CRS. Several geometries are merged into one area.zones (
GeoSeries|GeoDataFrame|None) – Zones to measure separately: a GeoSeries or GeoDataFrame in any CRS. The result has one row per zone, indexed likezones.edge_types (
Optional[Iterable[str]]) – Measure only edges whosetypeis one of these, and the nodes they touch.boundary_buffer (
float|None) – Witharea: nodes with one street closer than this to the area boundary are not counted as dead ends (streets cut by clipping the graph to the area).Nonecounts them.precision (
float) – Grid for comparing segment end points, seeunique_segments().
- Return type:
- Returns:
Series of measures, or with
zonesa DataFrame with one row per zone.- Raises:
TypeError – If
urban_graphis not anUrbanGraphorarea/zoneshave a wrong type.ValueError – If the CRS is geographic, or both
areaandzonesare passed.