Coverage for graphqler / chains / strategies / base_strategy.py: 100%
7 statements
« prev ^ index » next coverage.py v7.13.4, created at 2026-03-20 10:09 -0400
« prev ^ index » next coverage.py v7.13.4, created at 2026-03-20 10:09 -0400
1"""Abstract base class for chain generation strategies."""
3from abc import ABC, abstractmethod
5import networkx
7from graphqler.chains.chain import Chain
8from graphqler.graph.node import Node
11class BaseChainStrategy(ABC):
12 """Abstract base class for dependency-chain generation strategies.
14 Subclasses implement :meth:`generate` to produce a list of :class:`Chain` objects
15 from the dependency graph and a set of starter nodes.
16 """
18 @abstractmethod
19 def generate(self,
20 graph: networkx.DiGraph,
21 starter_nodes: list[Node],
22 filter_mutation_type: list[str] | None = None) -> list[Chain]:
23 """Generate chains from the dependency graph.
25 Args:
26 graph (networkx.DiGraph): The compiled dependency graph.
27 starter_nodes (list[Node]): Root nodes (nodes with no, or minimal, in-degree).
28 filter_mutation_type (list[str] | None): Mutation types whose nodes should be
29 excluded from generated chains (and whose subtrees are not traversed).
30 Pass an empty list or ``None`` to include all nodes. Defaults to ``None``.
32 Returns:
33 list[Chain]: The generated chains.
34 """
35 ...