Skip to content

Commit 7502c58

Browse files
committed
limit compelxity for plantuml
1 parent d5b9a3e commit 7502c58

9 files changed

+287
-27
lines changed

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# This file is autogenerated by pip-compile with Python 3.13
2+
# This file is autogenerated by pip-compile with Python 3.12
33
# by the following command:
44
#
55
# pip-compile pyproject.toml

src/rebdhuhn/graph_utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from networkx import DiGraph, all_simple_paths # type:ignore[import-untyped]
1010

1111
from rebdhuhn.models import ToNoEdge, ToYesEdge
12-
from rebdhuhn.models.errors import PathsNotGreaterThanOneError
12+
from rebdhuhn.models.errors import GraphTooComplexForPlantumlError, PathsNotGreaterThanOneError
1313

1414
COMMON_ANCESTOR_FIELD = "common_ancestor_for_node"
1515
# Defines the label to annotate the last common ancestor node with the information to which node
@@ -40,6 +40,10 @@ def _mark_last_common_ancestors(graph: DiGraph) -> None:
4040
Each node which is such an ancestor will contain the information of which nodes it is the last common ancestor.
4141
It is stored in the dict field `COMMON_ANCESTOR_FIELD` as a list.
4242
"""
43+
if len(graph.nodes) > 90:
44+
raise GraphTooComplexForPlantumlError(
45+
message=f"Graph is too large to determine the last common ancestors." f"Number of Nodes: {len(graph.nodes)}"
46+
)
4347
for node in graph:
4448
in_degree: int = graph.in_degree(node)
4549
if in_degree <= 1:

unittests/output/E_0003.dot.svg

Lines changed: 27 additions & 1 deletion
Loading

unittests/output/E_0003_with_watermark_background_is_False.dot.svg

Lines changed: 27 additions & 1 deletion
Loading

unittests/output/E_0003_with_watermark_background_is_True.dot.svg

Lines changed: 27 additions & 1 deletion
Loading

unittests/output/E_0003_without_watermark.dot.svg

Lines changed: 38 additions & 19 deletions
Loading

0 commit comments

Comments
 (0)