implemented check for deleted vertices and edges