Prevent duplicate random edges
Make graph global