Graph implementation for solving graph problems (java)
Don't store method flow flags as state in classes. This is a breach in object-oriented design.


class Node
{
    public boolean visited;
    // .. other
}



Search methods like dfs should use a map of some sort to store which nodes are visited.

By storing this flag incorrectly as state, you'll get in trouble when multiple threads search the graph concurrently.