pub fn object_graph(
model: &DataModel,
root: &str,
) -> Result<DiGraph<Object, ()>, String>Expand description
Creates a directed graph representing dependencies between objects in a data model.
This function builds a directed graph where nodes represent objects and edges represent dependencies between them. A dependency exists when one object’s attributes reference another object as its data type. The graph is built recursively starting from the root object and includes only objects reachable from the root.
§Arguments
model- The data model containing objects and their relationshipsroot- The name of the root object to start building the graph from
§Returns
A directed graph (DiGraph) where:
- Nodes contain the full Object structs
- Edges represent dependencies between objects (empty unit type)
- Only objects reachable from the root are included in the graph
§Errors
Returns an error if the root object is not found in the model or if there are issues traversing the object dependencies.