Detect if a graph has cycles:
Inputs
n: the number of vertices (where each vertex corresponds to an integer from 1 to n)
edges: the list of edges (in the form of pairs (i, j) where i and j represent vertices)
Return:
true if the graph has cycles and false otherwise
Solution Stats
Solution Comments
Show comments
Loading...
Problem Recent Solvers8
Suggested Problems
-
3849 Solvers
-
Maximum running product for a string of numbers
2257 Solvers
-
Back to basics 21 - Matrix replicating
1813 Solvers
-
Return elements unique to either input
812 Solvers
-
Construct an index vector from two input vectors in vectorized fashion
460 Solvers
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!