graph
graph ¶
Lineage graph data structure for representing entity relationships.
LineageEdge
dataclass
¶
LineageEdge(
dependent_node: LineageNode,
dependency_node: LineageNode,
metadata: dict[str, Any] = dict(),
)
Represents a directed relationship between two nodes in the lineage graph.
Edges are derived from dependencies and dependents on LineageNodes. The edge direction is: dependent_node depends on dependency_node.
LineageGraph
dataclass
¶
LineageGraph(
nodes: set[LineageNode] = set(),
edges: set[LineageEdge] = set(),
metadata: dict[str, Any] = dict(),
)
Format-agnostic lineage graph data structure.
Manages nodes and edges representing lineage relationships. Graph construction is synchronous - operates on pre-loaded DomoLineage_Link objects.
All complex traversal logic should be handled by
add_edge ¶
add_edge(edge: LineageEdge) -> None
Add edge to graph (automatically deduplicates by hash/eq).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
edge
|
LineageEdge
|
LineageEdge to add |
required |
Source code in src/crew_dcs/integrations/graphs/graph.py
136 137 138 139 140 141 142 | |
add_node ¶
add_node(node: LineageNode) -> None
Add node to graph (automatically deduplicates by hash/eq).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node
|
LineageNode
|
LineageNode to add |
required |
Source code in src/crew_dcs/integrations/graphs/graph.py
128 129 130 131 132 133 134 | |
from_lineage_links
classmethod
¶
from_lineage_links(
links: list[DomoLineage_Link],
) -> LineageGraph
Build graph from LineageLink list (synchronous operation).
Constructs nodes and edges from pre-loaded lineage links.
All complex traversal logic should be handled by
This method only: 1. Creates LineageNode objects from links 2. Creates LineageEdge objects from dependencies/dependents 3. Deduplicates nodes and edges (via set operations)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
links
|
list[DomoLineage_Link]
|
List of LineageLink with loaded entities and populated dependencies/dependents |
required |
Returns:
| Type | Description |
|---|---|
LineageGraph
|
LineageGraph with deduplicated nodes and edges |
Source code in src/crew_dcs/integrations/graphs/graph.py
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | |
LineageNode
dataclass
¶
LineageNode(id: str, lineage_link: DomoLineage_Link)
Core node representation for lineage graph operations.
Separates data model (LineageNode) from presentation (MermaidNode). Designed for graph traversal, deduplication, and relationship tracking.
All graph construction is synchronous - nodes are created from pre-loaded LineageLink objects, no API calls occur during node creation.
node_key
property
¶
node_key: tuple[str, str]
Unique key for graph operations: (id, entity_type).
Always converts ID to string for consistent key comparison.
from_lineage_link
classmethod
¶
from_lineage_link(link: DomoLineage_Link) -> LineageNode
Create node from lineage link.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
link
|
DomoLineage_Link
|
LineageLink (may or may not have loaded entity) |
required |
Returns:
| Type | Description |
|---|---|
LineageNode
|
LineageNode with available metadata |
Source code in src/crew_dcs/integrations/graphs/graph.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 | |