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

1"""Abstract base class for chain generation strategies.""" 

2 

3from abc import ABC, abstractmethod 

4 

5import networkx 

6 

7from graphqler.chains.chain import Chain 

8from graphqler.graph.node import Node 

9 

10 

11class BaseChainStrategy(ABC): 

12 """Abstract base class for dependency-chain generation strategies. 

13 

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 """ 

17 

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. 

24 

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``. 

31 

32 Returns: 

33 list[Chain]: The generated chains. 

34 """ 

35 ...