Remove dependency with jgrapht