dominikbraun / graph

A library for creating generic graph data structures and modifying, analyzing, and visualizing them.
https://graph.dominikbraun.io
Apache License 2.0
1.8k stars 94 forks source link

Methods for running a DFS and BFS over all vertices #124

Open dominikbraun opened 1 year ago

dominikbraun commented 1 year ago

The current DFS and BFS methods require a starting vertex as an argument and will only visit vertices that are reachable from these starting vertices. There should be separate methods that don't take such an argument and traverse all vertices in the graph, even if the graph is disconnected.

Maybe, appropriate names could be FullDFS, DFSAll, DFSFull or something like that. It would make more sense to use DFS as a name and rename the method with the starting vertex to DFSFrom, but I don't think I want to break the API at this point.