Basic Graph Algorithms implementation in Java