Graph-Native Infrastructure for Context and Accountable AI Systems
Python agent-memoryaiai-governanceai-infrastructureartificial-intelligencecontext-engineeringcontext-graphsdata-engineeringdecision-intelligencedeveloper-toolsexplainable-aigenerative-aigraph-ragknowledge-graphllmontologyprovenancepythonreasoningsemantic-search
fix: Resolve KG analytics API mismatch in ContextGraph
KaifAhmad162bf3bada97a
diff --git a/semantica/context/context_graph.py b/semantica/context/context_graph.pyindex 0c16ad6f..4084391c 100644--- a/semantica/context/context_graph.py+++ b/semantica/context/context_graph.py@@ -998,7 +998,7 @@ class ContextGraph:# Centrality analysisif "centrality_calculator" in self.kg_components:- centrality = self.kg_components["centrality_calculator"].calculate_all_centralities(kg_graph)+ centrality = self.kg_components["centrality_calculator"].calculate_all_centrality(kg_graph)analysis["centrality_analysis"] = centrality# Community detection@@ -1053,7 +1053,7 @@ class ContextGraph:subgraph = self._get_node_subgraph(node_id, max_depth=2)# Calculate centrality- centrality = self.kg_components["centrality_calculator"].calculate_all_centralities(subgraph)+ centrality = self.kg_components["centrality_calculator"].calculate_all_centrality(subgraph)# Cache resultself._analytics_cache[cache_key] = centrality.get(node_id, {})@@ -1109,6 +1109,7 @@ class ContextGraph:"""Convert context graph to KG-compatible format."""nodes = []edges = []+ relationships = []# Convert nodesfor node_id, node in self.nodes.items():@@ -1121,15 +1122,21 @@ class ContextGraph:# Convert edgesfor edge in self.edges:- edges.append({+ edge_data = {"source": edge.source_id,"target": edge.target_id,"type": edge.edge_type,"weight": edge.weight,"properties": edge.metadata- })+ }+ edges.append(edge_data)+ relationships.append(edge_data)- return {"nodes": nodes, "edges": edges}+ return {+ "nodes": nodes,+ "edges": edges,+ "relationships": relationships # KG algorithms expect this key+ }def _get_node_type_distribution(self) -> Dict[str, int]:"""Get distribution of node types."""