Graph help using petgraph

I have been working on a graph question find the start and end points in a graph. I have managed to get pass the first test case using dfs. But there next test case has a cycle inside it. Here is what the edges look like (0,3) (1,2) (3,2) (2,4) (4,3) (2,5)
Start points: 0, 1 Endpoints: 5. What would be the best approach for this? Not look for a answer more so a hint in the right direction. Thanks for any help.

Which version of dfs are you using, e.g. the Dfs in petgraph::visit - Rust
or depth_first_search in petgraph::visit - Rust the latter one allows greater flexibility with cyclic graphs, and both the examples for it contain graphs with cycles.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.