More precise version of randomUndirectedGraph. Takes into account edges which must be there so graph is connected.