switched to sets of edges instead of nodes