Opened 8 months ago
Closed 8 months ago
#27127 closed enhancement (fixed)
py3: avoid .vertices() in method ear_decomposition
Reported by: | dcoudert | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-8.7 |
Component: | graph theory | Keywords: | py3, graph |
Cc: | Merged in: | ||
Authors: | David Coudert | Reviewers: | Travis Scrimshaw |
Report Upstream: | N/A | Work issues: | |
Branch: | 8f382df (Commits) | Commit: | 8f382df077017468f9a135e066c34015ae4bf5ab |
Dependencies: | Stopgaps: |
Description
We avoid using .vertices()
in this method and fix a failing doctest for py3.
Change History (5)
comment:1 Changed 8 months ago by
- Branch set to public/27127_ear_decomposition
- Commit set to 8f382df077017468f9a135e066c34015ae4bf5ab
- Status changed from new to needs_review
comment:2 Changed 8 months ago by
Why this change:
- sage: g = graphs.CubeGraph(2) + sage: g = graphs.CycleGraph(4) sage: g.ear_decomposition() - [['00', '01', '11', '10', '00']] + [[0, 3, 2, 1, 0]]
comment:3 Changed 8 months ago by
This change is independent of using .vertices()
or not.
This doctest was failing with py3. My understanding is that neighbors of a vertex are visited in different orders in py2 and py3 as the order in which elements of a set are listed might differ (see G._backend.iterator_nbrs??
). Here, if the first visited neighbor of '00'
is '01'
or '10'
, we get different answers. With py3 we get [['00', '10', '11', '01', '00']]
and so the doctest was failing.
Using CycleGraph(4)
, the doctest is more stable and we get the same answer with py2 and py3. CubeGraph(2)
is a cycle of order 4, so it's essentially the same test.
comment:4 Changed 8 months ago by
- Reviewers set to Travis Scrimshaw
- Status changed from needs_review to positive_review
I don't think it is any more stable of a test, just something that happens to work on both. Anyways, this is okay with me since there is not such an easy way out of this.
comment:5 Changed 8 months ago by
- Branch changed from public/27127_ear_decomposition to 8f382df077017468f9a135e066c34015ae4bf5ab
- Resolution set to fixed
- Status changed from positive_review to closed
New commits:
trac #27127: avoid .vertices() in ear_decomposition