ontocast.util.graph_metrics¶
Structural telemetry for a facts graph.
Connectivity summaries answer "did extraction produce one knowledge graph or a pile of islands?" without any domain vocabulary: nodes are the fact-namespace IRIs, edges are IRI-to-IRI statements outside the annotation substrate. Used by the run manifest so fragmentation regressions are visible per document instead of requiring an offline notebook.
Classes¶
GraphShapeMetrics
¶
Bases: BaseModel
Connectivity summary of one facts graph.
Source code in ontocast/util/graph_metrics.py
Attributes¶
components = Field(description='Connected components (undirected).')
class-attribute
instance-attribute
¶
edges = Field(description='Distinct IRI-to-IRI links between them.')
class-attribute
instance-attribute
¶
isolated_nodes = Field(description='Nodes with no entity link at all.')
class-attribute
instance-attribute
¶
largest_component = Field(description='Node count of the largest one.')
class-attribute
instance-attribute
¶
nodes = Field(description='Fact-namespace IRIs present in the graph.')
class-attribute
instance-attribute
¶
Functions:¶
facts_graph_shape_metrics(graph, fact_namespaces)
¶
Compute connectivity metrics over the graph's fact-namespace entities.
Objects outside the fact namespaces (catalog reference individuals, units) still connect the fact nodes that share them — linking through a catalog individual is by design, not fragmentation.