metrics¶
Spatial and temporal graph metric computations.
- class fstg_toolkit.metrics.MetricsRegistry(_MetricsRegistry__registry: dict[str, MetricFunction] = <factory>)[source]¶
Bases:
objectA named registry that maps metric names to their computation functions.
Metrics are stored in an internal dictionary and can be added, removed, and iterated over. The registry is frozen at the dataclass level, but the internal dict is mutable to allow dynamic registration of metrics.
- fstg_toolkit.metrics.assortativity(graph: SpatioTemporalGraph) float[source]¶
- fstg_toolkit.metrics.average_degree(graph: SpatioTemporalGraph) float[source]¶
- fstg_toolkit.metrics.burstiness(graph: SpatioTemporalGraph) float[source]¶
- fstg_toolkit.metrics.calculate_spatial_metrics(graph: SpatioTemporalGraph) list[MetricRecord][source]¶
- fstg_toolkit.metrics.calculate_temporal_metrics(graph: SpatioTemporalGraph) list[MetricRecord][source]¶
- fstg_toolkit.metrics.clustering(graph: SpatioTemporalGraph) float[source]¶
- fstg_toolkit.metrics.density(graph: SpatioTemporalGraph) float[source]¶
- fstg_toolkit.metrics.gather_metrics(dataset: ~fstg_toolkit.io.GraphsDataset, selection: ~typing.Sequence[tuple[str, ...]], calculator: MetricsCalculator, callback: ~typing.Callable[[tuple[str, ...]], None] | None = <function <lambda>>, max_cpus: int = 1) DataFrame[source]¶
- fstg_toolkit.metrics.get_metrics_registry(name: str) MetricsRegistry[source]¶
Return (or create) the named
MetricsRegistry.- Parameters:
name (str) – The registry name, e.g.
'local'or'global'.- Returns:
The registry associated with name. A new empty registry is created the first time a name is requested.
- Return type:
- fstg_toolkit.metrics.global_efficiency(graph: SpatioTemporalGraph) float[source]¶
- fstg_toolkit.metrics.memory(graph: SpatioTemporalGraph) float[source]¶
- fstg_toolkit.metrics.metrics_index_columns(index_columns: list[str] | None)[source]¶
Decorator that attaches extra index column names to a metrics calculator.
The annotated column names are later used by
gather_metrics()to promote those columns from the records DataFrame into multi-level index levels.
- fstg_toolkit.metrics.modularity(graph: SpatioTemporalGraph) float[source]¶
- fstg_toolkit.metrics.reorg_rate(graph: SpatioTemporalGraph) float[source]¶