Skip to content

Commit cae3aac

Browse files
committed
some care for graphs in sage/combinat/posets/d_complete.py
1 parent d3b2e16 commit cae3aac

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

src/sage/combinat/posets/d_complete.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -89,18 +89,20 @@ def _hooks(self):
8989

9090
# Check if any of these make a longer double tailed diamond
9191
found_diamond = False
92-
for (mn, mx) in [(i, j) for i in potential_min for j in potential_max]:
93-
if len(H.neighbors_in(mx)) != 1:
92+
for mx in potential_max:
93+
if H.in_degree(mx) != 1:
9494
continue
95-
if len(H.all_paths(mn, mx)) == 2:
96-
# Success
97-
min_elmt = mn
98-
max_elmt = mx
99-
100-
min_diamond[mx] = mn
101-
max_diamond[mn] = mx
102-
diamond_index[mx] = index
103-
found_diamond = True
95+
for mn in potential_min:
96+
if len(H.all_paths(mn, mx)) == 2:
97+
# Success
98+
min_elmt = mn
99+
max_elmt = mx
100+
min_diamond[mx] = mn
101+
max_diamond[mn] = mx
102+
diamond_index[mx] = index
103+
found_diamond = True
104+
break
105+
if found_diamond:
104106
break
105107
if not found_diamond:
106108
break

0 commit comments

Comments
 (0)