Graph#

exception yaflux._graph.CircularDependencyError(node)[source]#

Bases: Exception

exception yaflux._graph.MutabilityConflictError(level, conflicts)[source]#

Bases: Exception

yaflux._graph.build_read_graph(analysis)[source]#

Build adjacency list of step dependencies.

Includes both regular, flag, and mutation dependencies.

Returns:

Graph indexed by step name with values as sets of dependent step names. An edge A -> B means step A depends on step B.

Return type:

dict[str, set[str]]

yaflux._graph.build_write_graph(analysis)[source]#

Build adjacency list of step dependencies.

Includes only mutation dependencies.

Returns:

Graph indexed by step name with values as sets of dependent step names. An edge A -> B means step A depends on step B.

Return type:

dict[str, set[str]]

yaflux._graph.compute_topological_levels(graph)[source]#

Compute the topological level of each step in the graph.

A step’s level is 1 + the maximum level of its dependencies. Steps with no dependencies have level 0.

Parameters:

graph (dict[str, set[str]]) – Graph indexed by step name with values as sets of dependent step names. An edge A -> B means step A depends on step B.

Returns:

Mapping of step names to their topological level.

Return type:

dict[str, int]

yaflux._graph.validate_incompatible_mutability(read_graph, write_graph, levels)[source]#

Validate that no steps at the same level have incompatible mutability.

Steps at the same level must not have any shared dependencies that are mutated.

Parameters:
  • read_graph (dict[str, set[str]]) – Graph of read dependencies indexed by step name.

  • write_graph (dict[str, set[str]]) – Graph of write dependencies indexed by step name.

  • levels (dict[str, int]) – Mapping of step names to their topological level.

Return type:

None