public void deleteEdge ( Direction direction , Schema . EdgeLabel label , VertexElement ... targets ) { Iterator < Edge > edges = element ( ) . edges ( direction , label . getLabel ( ) ) ; if ( targets . length == 0 ) { edges . forEachRemaining ( Edge :: remove ) ; } else { Set < Vertex > verticesToDelete = Arrays . stream ( targets ) . map ( AbstractElement :: element ) . collect ( Collectors . toSet ( ) ) ; edges . forEachRemaining ( edge -> { boolean delete = false ; switch ( direction ) { case BOTH : delete = verticesToDelete . contains ( edge . inVertex ( ) ) || verticesToDelete . contains ( edge . outVertex ( ) ) ; break ; case IN : delete = verticesToDelete . contains ( edge . outVertex ( ) ) ; break ; case OUT : delete = verticesToDelete . contains ( edge . inVertex ( ) ) ; break ; } if ( delete ) edge . remove ( ) ; } ) ; } }
Deletes all the edges of a specific Schema . EdgeLabel to or from a specific set of targets . If no targets are provided then all the edges of the specified type are deleted