vis graph o(n^2)