Skip to content

Commit

Permalink
fix documentation for cycle.py
Browse files Browse the repository at this point in the history
  • Loading branch information
shellfly committed Jun 9, 2019
1 parent 786ef4c commit f6a2dca
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions algs4/cycle.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
"""
Compilation: javac Cycle.java
Execution: java Cycle filename.txt
Dependencies: Graph.java Stack.java In.java StdOut.java
Data files: https: // algs4.cs.princeton.edu / 41graph / tinyG.txt
https: // algs4.cs.princeton.edu / 41graph / mediumG.txt
https: // algs4.cs.princeton.edu / 41graph / largeG.txt
Execution: python cycle.py filename.txt
Data files: https://algs4.cs.princeton.edu/41graph/tinyG.txt
https://algs4.cs.princeton.edu/41graph/mediumG.txt
https://algs4.cs.princeton.edu/41graph/largeG.txt
Identifies a cycle.
Runs in O(E + V) time.
% java Cycle tinyG.txt
% python cycle.py tinyG.txt
3 4 5 3
% java Cycle mediumG.txt
% python cycle.py mediumG.txt
15 0 225 15
% java Cycle largeG.txt
% python cycle.py largeG.txt
996673 762 840164 4619 785187 194717 996673
"""

Expand All @@ -39,6 +37,7 @@ def dfs(self, G, v, u):
elif w != u:
self.has_cycle = True


if __name__ == "__main__":
import sys
f = open(sys.argv[1])
Expand Down

0 comments on commit f6a2dca

Please sign in to comment.