Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exceptions when multiedges/loops are not supported #15572

Closed
nathanncohen mannequin opened this issue Dec 23, 2013 · 13 comments
Closed

Exceptions when multiedges/loops are not supported #15572

nathanncohen mannequin opened this issue Dec 23, 2013 · 13 comments

Comments

@nathanncohen
Copy link
Mannequin

nathanncohen mannequin commented Dec 23, 2013

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

CC: @sagetrac-azi @sagetrac-sage-combinat @nthiery @dcoudert

Component: graph theory

Author: Nathann Cohen

Branch/Commit: u/ncohen/15572 @ 606221c

Reviewer: Jean-Baptiste Priez

Issue created by migration from https://trac.sagemath.org/ticket/15572

@nathanncohen nathanncohen mannequin added this to the sage-6.1 milestone Dec 23, 2013
@nathanncohen
Copy link
Mannequin Author

nathanncohen mannequin commented Dec 23, 2013

Branch: u/ncohen/15572

@nathanncohen
Copy link
Mannequin Author

nathanncohen mannequin commented Dec 23, 2013

New commits:

843473atrac #15572: Exceptions when multiedges/loops are not supported

@nathanncohen
Copy link
Mannequin Author

nathanncohen mannequin commented Dec 23, 2013

Commit: 843473a

@nathanncohen nathanncohen mannequin added the s: needs review label Dec 23, 2013
@nathanncohen
Copy link
Mannequin Author

nathanncohen mannequin commented Dec 31, 2013

comment:2

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

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 31, 2013

Branch pushed to git repo; I updated commit sha1. New commits:

b7f01c9trac #15572: DiGraph.is_directed_acyclic handles loops pretty well
3bf44batrac #15572: Rebase on 6.1.beta2

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 31, 2013

Changed commit from 843473a to b7f01c9

@sagetrac-elixyre
Copy link
Mannequin

sagetrac-elixyre mannequin commented Dec 31, 2013

Reviewer: elixyre

@sagetrac-elixyre
Copy link
Mannequin

sagetrac-elixyre mannequin commented Dec 31, 2013

Changed reviewer from elixyre to Jean-Baptiste Priez

@vbraun
Copy link
Member

vbraun commented Jan 4, 2014

comment:6

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
**********************************************************************

@nathanncohen
Copy link
Mannequin Author

nathanncohen mannequin commented Jan 4, 2014

comment:7

Sorry 'bout that. Just fixed it by updating the last commit.

Nathann

@nathanncohen
Copy link
Mannequin Author

nathanncohen mannequin commented Jan 4, 2014

Changed commit from b7f01c9 to none

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 4, 2014

Commit: 606221c

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 4, 2014

Branch pushed to git repo; I updated commit sha1. New commits:

606221ctrac #15572: DiGraph.is_directed_acyclic handles loops pretty well
3bf44batrac #15572: Rebase on 6.1.beta2
843473atrac #15572: Exceptions when multiedges/loops are not supported

@vbraun vbraun closed this as completed in 4c2a75c Jan 5, 2014
tscrim pushed a commit to tscrim/sage that referenced this issue Jun 1, 2023
* develop: (59 commits)
  Updated Sage version to 6.1.beta4
  trac sagemath#15572: DiGraph.is_directed_acyclic handles loops pretty well
  Fixed bug in uniform matroid.
  trac sagemath#15619: Pickling multigraphs with loops and labels
  Trac 15619: Review commit
  Trac 15603: More doctests, nicer error message
  No need to specify caller_name in verbose()
  Add comments, small cosmetic changes
  Make q monic before computing cubic resolvent
  Implement splitting fields for number fields
  trac sagemath#15619: bug in the former definition; exception to avoid it in the future
  trac 8723: fix one line in isogeny_small_degree
  Use "in" instead of PyDict_Contains()
  test for membership with `x in self`; minor doc formatting change
  trac sagemath#15619: Pickling of immutable graphs
  Rebased on sage-6.1.beta2
  # User Thomas Feulner <thomas.feulner@uni-bayreuth.de>
  Implemented IntegerVectors_nk.rank(). Fixes sagemath#15609
  Trac sagemath#5153: small change in documentation.
  Trac 7695: Variable name for all subfields where the name ends with a digit
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant