Factored out common Node class in separate algorithms and put it in graph.py