Test graph distance