metrics.graph ============= .. py:module:: metrics.graph Classes ------- .. autoapisummary:: metrics.graph.GraphMetrics Module Contents --------------- .. py:class:: GraphMetrics(target_names=None) Handles graph-level metric calculations .. py:attribute:: COMMUNITY_BOUNDARY_THRESHOLD :value: 0.2 .. py:attribute:: target_names :value: None .. py:method:: calculate_class_boundaries(key: str, nodes: List[str], class_names: List[str]) -> tuple :staticmethod: Static method for boundary calculation .. py:method:: calculate_boundaries(class_dict: Dict, class_names: List[str]) -> Dict :classmethod: Parallel boundary calculation .. py:method:: extract_class_boundaries(dpg_model: networkx.DiGraph, nodes_list: List[tuple], target_names: List[str]) -> Dict :classmethod: Extract class boundaries from community assignments (cluster-based), not from the legacy LPA graph-metrics path. .. py:method:: extract_graph_metrics(dpg_model: networkx.DiGraph, nodes_list: List[tuple], target_names: List[str]) -> Dict :classmethod: Backwards-compatible graph metrics interface. This delegates to the current LPA-based implementation to keep older examples and notebooks working. .. py:method:: extract_graph_metrics_lpa(dpg_model: networkx.DiGraph, nodes_list: List[tuple], target_names: List[str]) -> Dict :classmethod: Main interface for graph metrics .. py:method:: extract_communities(dpg_model, df_node_metrics, nodes_list, threshold_clusters=0.2) -> Dict :classmethod: .. py:method:: communities_to_csv(communities: Dict, file_path: str) -> None :staticmethod: Save communities output to a CSV file. The CSV is written in a long format with columns: Section, Key, Value. .. py:method:: clustering(dpg_model, class_nodes, threshold=None) :classmethod: .. py:method:: extract_feature_intervals(decisions) :classmethod: .. py:method:: create_dataframes(data) :classmethod: