Skip to content

Commit d3b2e16

Browse files
committed
some care for graphs in sage/combinat/posets/hasse_diagram.py
1 parent 4e20e93 commit d3b2e16

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/sage/combinat/posets/hasse_diagram.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ def _precompute_intervals(self):
598598
"""
599599
n = self.order()
600600
v_up = (frozenset(self.depth_first_search(v)) for v in range(n))
601-
v_down = [frozenset(self.depth_first_search(v, neighbors=self.neighbors_in))
601+
v_down = [frozenset(self.depth_first_search(v, neighbors=self.neighbor_in_iterator))
602602
for v in range(n)]
603603
self._intervals = [[sorted(up.intersection(down)) for down in v_down]
604604
for up in v_up]
@@ -1232,7 +1232,7 @@ def order_ideal(self, elements):
12321232
[0, 1, 2, 3, 4, 5, 6, 7, 8, 10]
12331233
"""
12341234
return sorted(self.depth_first_search(elements,
1235-
neighbors=self.neighbors_in))
1235+
neighbors=self.neighbor_in_iterator))
12361236

12371237
def order_ideal_cardinality(self, elements):
12381238
r"""
@@ -1256,7 +1256,7 @@ def order_ideal_cardinality(self, elements):
12561256
continue
12571257
size += 1
12581258
seen.add(v)
1259-
q.extend(self.neighbors_in(v))
1259+
q.extend(self.neighbor_in_iterator(v))
12601260

12611261
return ZZ(size)
12621262

@@ -2545,9 +2545,9 @@ def common_upper_covers(self, vertices):
25452545
sage: H.common_upper_covers([4, 5]) # optional - sage.combinat
25462546
[6]
25472547
"""
2548-
covers = set(self.neighbors_out(vertices.pop()))
2548+
covers = set(self.neighbor_out_iterator(vertices.pop()))
25492549
for v in vertices:
2550-
covers = covers.intersection(self.neighbors_out(v))
2550+
covers = covers.intersection(self.neighbor_out_iterator(v))
25512551
return list(covers)
25522552

25532553
def common_lower_covers(self, vertices):
@@ -2566,9 +2566,9 @@ def common_lower_covers(self, vertices):
25662566
sage: H.common_lower_covers([4, 5]) # optional - sage.combinat
25672567
[3]
25682568
"""
2569-
covers = set(self.neighbors_in(vertices.pop()))
2569+
covers = set(self.neighbor_in_iterator(vertices.pop()))
25702570
for v in vertices:
2571-
covers = covers.intersection(self.neighbors_in(v))
2571+
covers = covers.intersection(self.neighbor_in_iterator(v))
25722572
return list(covers)
25732573

25742574
def _trivial_nonregular_congruence(self):
@@ -2764,7 +2764,7 @@ def sublattice(elms, e):
27642764
break
27652765

27662766
# Special case to handle at last.
2767-
if len(self.neighbors_out(0)) == 1:
2767+
if self.out_degree(0) == 1:
27682768
result.append(set(range(1, N)))
27692769

27702770
return result
@@ -2830,8 +2830,8 @@ def kappa_dual(self, a):
28302830
uc = next(self.neighbor_out_iterator(a))
28312831
if self.in_degree(uc) == 1:
28322832
return uc
2833-
lt_a = set(self.depth_first_search(a, neighbors=self.neighbors_in))
2834-
tmp = list(self.depth_first_search(uc, neighbors=lambda v: [v_ for v_ in self.neighbor_in_iterator(v) if v_ not in lt_a]))
2833+
lt_a = set(self.depth_first_search(a, neighbors=self.neighbor_in_iterator))
2834+
tmp = set(self.depth_first_search(uc, neighbors=lambda v: [v_ for v_ in self.neighbor_in_iterator(v) if v_ not in lt_a]))
28352835
result = None
28362836
for e in tmp:
28372837
if all(x not in tmp for x in self.neighbor_in_iterator(e)):
@@ -2990,7 +2990,7 @@ def neutral_elements(self):
29902990

29912991
def is_neutral(a):
29922992
noncomp = all_elements.difference(self.depth_first_search(a))
2993-
noncomp.difference_update(self.depth_first_search(a, neighbors=self.neighbors_in))
2993+
noncomp.difference_update(self.depth_first_search(a, neighbors=self.neighbor_in_iterator))
29942994

29952995
for x in noncomp.intersection(todo):
29962996
meet_ax = mt[a, x]
@@ -3071,7 +3071,7 @@ def kappa(self, a):
30713071
if self.out_degree(lc) == 1:
30723072
return lc
30733073
gt_a = set(self.depth_first_search(a))
3074-
tmp = list(self.depth_first_search(lc, neighbors=lambda v: [v_ for v_ in self.neighbor_out_iterator(v) if v_ not in gt_a]))
3074+
tmp = set(self.depth_first_search(lc, neighbors=lambda v: [v_ for v_ in self.neighbor_out_iterator(v) if v_ not in gt_a]))
30753075
result = None
30763076
for e in tmp:
30773077
if all(x not in tmp for x in self.neighbor_out_iterator(e)):
@@ -3346,9 +3346,9 @@ def find_nontrivial_congruence(self):
33463346
join_irreducibles = [v for v in self if self.in_degree(v) == 1]
33473347
meet_irreducibles = [v for v in self if self.out_degree(v) == 1]
33483348
if len(join_irreducibles) < len(meet_irreducibles):
3349-
irr = [(v, self.neighbors_in(v)[0]) for v in join_irreducibles]
3349+
irr = [(v, next(self.neighbor_in_iterator(v))) for v in join_irreducibles]
33503350
else:
3351-
irr = [(self.neighbors_out(v)[0], v) for v in meet_irreducibles]
3351+
irr = [(next(self.neighbor_out_iterator(v)), v) for v in meet_irreducibles]
33523352
irr.sort(key=lambda x: x[0] - x[1])
33533353
tried = []
33543354
for pair in irr:

0 commit comments

Comments
 (0)