diff --git a/balm/_sd_algorithms/expand_source_SCCs.py b/balm/_sd_algorithms/expand_source_SCCs.py index 949d7e6..fc5b859 100644 --- a/balm/_sd_algorithms/expand_source_SCCs.py +++ b/balm/_sd_algorithms/expand_source_SCCs.py @@ -11,14 +11,15 @@ VariableId, ) -import balm.succession_diagram from balm._sd_algorithms.expand_bfs import expand_bfs from balm.space_utils import percolate_network, percolate_space from balm.types import BooleanSpace if TYPE_CHECKING: + from balm.succession_diagram import SuccessionDiagram + ExpanderFunctionType = Callable[ - [balm.succession_diagram.SuccessionDiagram, int | None, int | None, int | None], + [SuccessionDiagram, int | None, int | None, int | None], bool, ] @@ -28,7 +29,7 @@ def expand_source_SCCs( - sd: balm.succession_diagram.SuccessionDiagram, + sd: SuccessionDiagram, expander: ExpanderFunctionType = expand_bfs, check_maa: bool = True, ) -> bool: @@ -266,7 +267,7 @@ def restrict_to_component( def find_subnetwork_sd( sub_network: BooleanNetwork, expander: ExpanderFunctionType, check_maa: bool -) -> tuple[balm.succession_diagram.SuccessionDiagram, bool]: +) -> tuple[SuccessionDiagram, bool]: """ Computes a `SuccessionDiagram` of a particular sub-network using an expander function. @@ -280,11 +281,12 @@ def find_subnetwork_sd( True if there is motif avoidance """ + from balm import SuccessionDiagram if DEBUG: print("scc_bnet\n", sub_network.to_bnet()) - sub_sd = balm.succession_diagram.SuccessionDiagram(sub_network) + sub_sd = SuccessionDiagram(sub_network) fully_expanded = expander(sub_sd, None, None, None) assert fully_expanded @@ -306,8 +308,8 @@ def find_subnetwork_sd( def attach_scc_sd( - sd: balm.succession_diagram.SuccessionDiagram, - scc_sd: balm.succession_diagram.SuccessionDiagram, + sd: SuccessionDiagram, + scc_sd: SuccessionDiagram, branch: int, check_maa: bool, ) -> list[int]: diff --git a/tests/source_SCC_test.py b/tests/source_SCC_test.py index 4d124c2..54f6b61 100644 --- a/tests/source_SCC_test.py +++ b/tests/source_SCC_test.py @@ -1,6 +1,6 @@ from biodivine_aeon import AsynchronousGraph, BooleanNetwork -import balm.succession_diagram +from balm import SuccessionDiagram from balm._sd_algorithms.expand_source_SCCs import ( expand_source_SCCs, find_source_nodes, @@ -75,7 +75,7 @@ def test_find_scc_sd(): scc_sd, _ = find_subnetwork_sd( bn, - expander=balm.succession_diagram.SuccessionDiagram.expand_bfs, + expander=SuccessionDiagram.expand_bfs, check_maa=True, ) @@ -88,7 +88,7 @@ def test_find_scc_sd(): def expansion(bn: BooleanNetwork): - sd = balm.succession_diagram.SuccessionDiagram(bn) + sd = SuccessionDiagram(bn) fully_expanded = expand_source_SCCs(sd, check_maa=False) assert fully_expanded @@ -145,7 +145,7 @@ def test_expansion(): def attractor_search(bn: BooleanNetwork): - sd = balm.succession_diagram.SuccessionDiagram(bn) + sd = SuccessionDiagram(bn) fully_expanded = expand_source_SCCs(sd) assert fully_expanded @@ -369,10 +369,10 @@ def test_isomorph(): path = "models/bbm-bnet-inputs-true/005.bnet" bn = BooleanNetwork.from_file(path) - sd_bfs = balm.succession_diagram.SuccessionDiagram(bn) + sd_bfs = SuccessionDiagram(bn) sd_bfs.expand_bfs() - sd_scc = balm.succession_diagram.SuccessionDiagram(bn) + sd_scc = SuccessionDiagram(bn) expand_source_SCCs(sd_scc) assert [sd_bfs.node_space(id) for id in sd_bfs.node_ids()] == [