compute adjacenceis