For IntelliJ IDEA,
Android Studio or Eclipse



public void testKeyIndicesConsistentWithElementRemoval() throws Exception { KeyIndexableGraph graph = (KeyIndexableGraph) graphTest.generateGraph(); graph.createKeyIndex("foo", Vertex.class); Vertex v1 = graph.addVertex(null); v1.setProperty("foo", 42); vertexCount(graph, 1); graph.removeVertex(v1); vertexCount(graph, 0); assertEquals(0, count(graph.getVertices("foo", 42))); graph.shutdown(); }
public void removeVertex(final Vertex vertex) { verifyNativeElement(vertex); baseGraph.removeVertex(((IdVertex) vertex).getBaseVertex()); }
private void removeEdge(final Edge edge) { Vertex h = edge.getVertex(Direction.IN); Vertex t = edge.getVertex(Direction.OUT); store.graph.removeEdge(edge); if (!h.getEdges(Direction.IN).iterator().hasNext() && !h.getEdges(Direction.OUT).iterator().hasNext()) { try { store.graph.removeVertex(h); } catch (IllegalStateException ex) { // Just keep going. This is a hack for Neo4j vertices which appear in more than // one to-be-deleted edge. } } if (!t.getEdges(Direction.OUT).iterator().hasNext() && !t.getEdges(Direction.IN).iterator().hasNext()) { try { store.graph.removeVertex(t); } catch (IllegalStateException ex) { // Just keep going. This is a hack for Neo4j vertices which appear in more than // one to-be-deleted edge. } } }