Graph 1
graph1
presents a situation where we can use our naive approach to infer the solution. Why? because every vertex appears at least once in the from
and to
sides of an edge. The set difference in the end will yield an empty set.
An empty set with our approach means that we can use any vertex as the starting point and we could reach every other vertex using the cycles.
Graph 2
graph2
is clearly a good graph for our naive approach since the difference set will have more than one element, meaning that there is no way to reach all vertices.
Graph 3
This graph is a good fit for our approach since the difference set will leave us with the vertex labeled 4. From which we can reach all other vertices.
Graph 4
graph4
is a case where our naive approach falls short. This is basically a mixture between graph1
and graph3
. In this kind of graph we have a couple of cycles with one edge from one cycle to the other.
For graphs that have a structure like the one presented on graph4
. This is what I did.