Collection<GraphEdge> (@NotNull final GraphEdge edge) { Set<GraphEdge> result = new HashSet<>(); assert edge.getType() == GraphEdgeType.DOTTED; myDottedEdges.removeEdge(edge); Integer tail = edge.getUpNodeIndex(); Integer firstChild = edge.getDownNodeIndex(); assert tail != null : "Collapsed from to an unloaded node"; assert firstChild != null : "Collapsed edge to an unloaded node"; List<GraphEdge> downDottedEdges = myHiddenEdges.getAdjacentEdges(tail, EdgeFilter.NORMAL_DOWN); List<GraphEdge> upDottedEdges = myHiddenEdges.getAdjacentEdges(firstChild, EdgeFilter.NORMAL_UP); for (GraphEdge e : ContainerUtil.concat(downDottedEdges, upDottedEdges)) { myHiddenEdges.removeEdge(e); if (e.getType() == GraphEdgeType.DOTTED) { result.addAll(expandEdge(e)); } else { result.add(e); } } return result; }