metrics.graph#

Classes#

GraphMetrics

Handles graph-level metric calculations

Module Contents#

class metrics.graph.GraphMetrics(target_names=None)[source]#

Handles graph-level metric calculations

COMMUNITY_BOUNDARY_THRESHOLD = 0.2#
target_names = None#
static calculate_class_boundaries(key: str, nodes: List[str], class_names: List[str]) tuple[source]#

Static method for boundary calculation

classmethod calculate_boundaries(class_dict: Dict, class_names: List[str]) Dict[source]#

Parallel boundary calculation

classmethod extract_class_boundaries(dpg_model: networkx.DiGraph, nodes_list: List[tuple], target_names: List[str]) Dict[source]#

Extract class boundaries from community assignments (cluster-based), not from the legacy LPA graph-metrics path.

classmethod extract_graph_metrics(dpg_model: networkx.DiGraph, nodes_list: List[tuple], target_names: List[str]) Dict[source]#

Backwards-compatible graph metrics interface.

This delegates to the current LPA-based implementation to keep older examples and notebooks working.

classmethod extract_graph_metrics_lpa(dpg_model: networkx.DiGraph, nodes_list: List[tuple], target_names: List[str]) Dict[source]#

Main interface for graph metrics

classmethod extract_communities(dpg_model, df_node_metrics, nodes_list, threshold_clusters=0.2) Dict[source]#
static communities_to_csv(communities: Dict, file_path: str) None[source]#

Save communities output to a CSV file.

The CSV is written in a long format with columns: Section, Key, Value.

classmethod clustering(dpg_model, class_nodes, threshold=None)[source]#
classmethod extract_feature_intervals(decisions)[source]#
classmethod create_dataframes(data)[source]#