Refactor the generalized A* algorithm into a class, use the Graph abstract class instead of Node