public void removeNonBidirectionalConnections() {

        //For each source vertex edge, check that there is another connection between that target vertex and the source.
        //If not remove those edges for the the current edge.
        for (V sourceVertex : super.vertexSet()) {

            //Store edges to remove after looping over all edges
            final Set<V> edgesToRemove = new HashSet<V>();
            EdgeContainer<V, V> vertexEdges = getEdges(sourceVertex);

            //Check for each edge, that the graph contains another edge for it.
            for (final V targetVertex : vertexEdges) {


                //If the target vertex for the current edge is not connected to the source vertex mark to remove it.
                final VertexContainer targetVertexConnections = (VertexContainer) super.getEdges(targetVertex);
                if (targetVertexConnections == null || targetVertexConnections.isEmpty()) {
                    edgesToRemove.add(targetVertex);
                    Log.debug("Found edge" + sourceVertex + "->" + targetVertex + " which is no bidirectional. Adding for later removal");
                }
            }
            if (!edgesToRemove.isEmpty()) {
                Log.debug("Removing " + edgesToRemove.size() + " edges");
                vertexEdges.remove(edgesToRemove);
            }

        }

    }