23.11.2014 Views

Data Structures and Algorithms in Java[1].pdf - Fulvio Frisone

Data Structures and Algorithms in Java[1].pdf - Fulvio Frisone

Data Structures and Algorithms in Java[1].pdf - Fulvio Frisone

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Class F<strong>in</strong>dCycleDFS (Code Fragment 13.9) f<strong>in</strong>ds a cycle <strong>in</strong> the connected<br />

component of a given vertex v, by perform<strong>in</strong>g a depth-first search traversal from v<br />

that term<strong>in</strong>ates when a back edge is found. It returns a (possibly empty) iterable<br />

collection of the vertices <strong>and</strong> edges <strong>in</strong> the cycle formed by the found back edge.<br />

Code Fragment 13.9: Specialization of class DFS to<br />

f<strong>in</strong>d a cycle <strong>in</strong> the connected component of the start<br />

vertex.<br />

821

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!