Logo Search packages:      
Sourcecode: libjgrapht-java version File versions  Download package

void org::_3pq::jgrapht::ext::JGraphModelAdapter::handleJGraphRemovedVertex ( GraphCell  jVertex  )  [inline, package]

Removes the vertex corresponding to the specified JGraph vertex from the JGraphT graph. If the specified vertex is not contained in m_cellToVertex, it is silently ignored.

If any edges are incident with this vertex, we first remove them from the both graphs, because otherwise the JGraph graph would leave them intact and the JGraphT graph would throw them out. TODO: Revise this behavior now that we gracefully tolerate dangling edges. It might be possible to remove just the JGraphT edges. The JGraph edges will be left dangling, as a result.

This method is to be called only for vertices that have already been removed from the JGraph graph.

jVertex the JGraph vertex that has been removed.

Definition at line 630 of file JGraphModelAdapter.java.

References org::_3pq::jgrapht::ext::JGraphModelAdapter::ShieldedGraph::edgesOf(), m_cellToVertex, m_vertexToCell, org::_3pq::jgrapht::ext::JGraphModelAdapter::ShieldedGraph::removeAllEdges(), and org::_3pq::jgrapht::ext::JGraphModelAdapter::ShieldedGraph::removeVertex().

        if( m_cellToVertex.containsKey( jVertex ) ) {
            Object jtVertex        = m_cellToVertex.get( jVertex );
            List   jtIncidentEdges = m_jtGraph.edgesOf( jtVertex );

            if( !jtIncidentEdges.isEmpty(  ) ) {
                // We can't just call removeAllEdges with this list: that
                // would throw a ConcurrentModificationException. So we create
                // a shallow copy.
                // This also triggers removal of the corresponding JGraph edges.
                m_jtGraph.removeAllEdges( new ArrayList( jtIncidentEdges ) );

            m_jtGraph.removeVertex( jtVertex );

            m_cellToVertex.remove( jVertex );
            m_vertexToCell.remove( jtVertex );

Generated by  Doxygen 1.6.0   Back to index