Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
trac #15572: DiGraph.is_directed_acyclic handles loops pretty well
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanncohen committed Jan 4, 2014
1 parent 3bf44ba commit 606221c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/sage/graphs/digraph.py
Expand Up @@ -1027,8 +1027,19 @@ def is_directed_acyclic(self, certificate = False):
sage: all( random_acyclic(100, .2).is_directed_acyclic() # long time
... for i in range(50)) # long time
True
TESTS:
What about loops?::
sage: g = digraphs.ButterflyGraph(3)
sage: g.allow_loops(True)
sage: g.is_directed_acyclic()
True
sage: g.add_edge(0,0)
sage: g.is_directed_acyclic()
False
"""
self._scream_if_not_simple(allow_multiple_edges=True)
return self._backend.is_directed_acyclic(certificate = certificate)

def to_directed(self):
Expand Down

0 comments on commit 606221c

Please sign in to comment.