undirected graphs generation fix