Opened 5 years ago
Closed 5 years ago
#15572 closed defect (fixed)
Exceptions when multiedges/loops are not supported
Reported by: | ncohen | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-6.1 |
Component: | graph theory | Keywords: | |
Cc: | azi, combinat, nthiery, dcoudert | Merged in: | |
Authors: | Nathann Cohen | Reviewers: | Jean-Baptiste Priez |
Report Upstream: | N/A | Work issues: | |
Branch: | u/ncohen/15572 (Commits) | Commit: | 606221c3868cdb2df84654ec92756469c9836d18 |
Dependencies: | Stopgaps: |
Description
Some Graph functions are not made to handle non-simple graphs, i.e. graphs containing loops or multiple edges. This ticket adds necessary exceptions from place to place, hoping no error remains ignored.
The exception advises the user to remove loops/multiple edges from his graph and try again (and to update the function if he thinks that not supporting non-simple graphs is a mistake) :-P
This has been reported on sage-support fairly recently [1], and thousands of times before. Past time to deal with those wrong answers :-/
[1] https://groups.google.com/d/msg/sage-support/bsXYMXwgW5w/LPrmCNGoah0J
Change History (9)
comment:1 Changed 5 years ago by
- Branch set to u/ncohen/15572
- Commit set to 843473a223c0eaaaf02175df8a34d83fc05125da
- Status changed from new to needs_review
comment:2 Changed 5 years ago by
Looks like DiGraph.is_directed_acylic
actually has no problems with loops. The exception broke a doctest in rings/semirings/non_negative_integer_semiring.py
.
Fixed !
Nathann
comment:3 Changed 5 years ago by
- Commit changed from 843473a223c0eaaaf02175df8a34d83fc05125da to b7f01c979aa1e16b1295b6673cd1fdc7f3de7740
comment:4 Changed 5 years ago by
- Reviewers set to elixyre
- Status changed from needs_review to positive_review
comment:5 Changed 5 years ago by
- Reviewers changed from elixyre to Jean-Baptiste Priez
comment:6 Changed 5 years ago by
- Status changed from positive_review to needs_work
Doctest failures:
sage -t --long src/sage/graphs/digraph.py ********************************************************************** File "src/sage/graphs/digraph.py", line 1035, in sage.graphs.digraph.DiGraph.is_directed_acyclic Failed example: g.allow_loops(True) Exception raised: Traceback (most recent call last): File "/mnt/SSD1/mod_buildslave/sage_git/build/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 480, in _run self.execute(example, compiled, test.globs) File "/mnt/SSD1/mod_buildslave/sage_git/build/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 839, in execute exec compiled in globs File "<doctest sage.graphs.digraph.DiGraph.is_directed_acyclic[11]>", line 1, in <module> g.allow_loops(True) NameError: name 'g' is not defined **********************************************************************
comment:7 Changed 5 years ago by
- Commit b7f01c979aa1e16b1295b6673cd1fdc7f3de7740 deleted
- Status changed from needs_work to needs_review
Sorry 'bout that. Just fixed it by updating the last commit.
Nathann
comment:8 Changed 5 years ago by
- Commit set to 606221c3868cdb2df84654ec92756469c9836d18
comment:9 Changed 5 years ago by
- Resolution set to fixed
- Status changed from needs_review to closed
New commits:
trac #15572: Exceptions when multiedges/loops are not supported