COIN-OR::LEMON - Graph Library

Changeset 1281:164ca6938d09 in lemon-0.x


Ignore:
Timestamp:
03/31/05 15:29:05 (15 years ago)
Author:
Alpar Juttner
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1713
Message:
  • split() added
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/lemon/list_graph.h

    r1184 r1281  
    369369    ///
    370370    ///\note The <tt>Edge</tt>s
    371     ///referencing the moved edge remain
     371    ///referencing a moved edge remain
    372372    ///valid. However <tt>InEdge</tt>'s and <tt>OutEdge</tt>'s
    373373    ///may be invalidated.
     
    391391    }
    392392
    393 
     393    ///Split a node.
     394
     395    ///This function splits a node. First new node is added to the graph, then
     396    ///the source of each outgoing edge of \c n is moved to this new node.
     397    ///If \c connect is \c true (this is the default value), then a new edge
     398    ///from \c n to the newly created node is also added.
     399    ///\return The newly created node.
     400    ///
     401    ///\note The <tt>Edge</tt>s
     402    ///referencing a moved edge remain
     403    ///valid. However <tt>InEdge</tt>'s and <tt>OutEdge</tt>'s
     404    ///may be invalidated.
     405    ///\todo It could be implemented in a bit faster way.
     406    Node split(Node n, bool connect = true)
     407    {
     408      Node b = addNode();
     409      for(OutEdgeIt e(*this,n);e!=INVALID;) {
     410        OutEdgeIt f=e;
     411        ++f;
     412        moveSource(e,b);
     413        e=f;
     414      }
     415      if(connect) addEdge(n,b);
     416      return b;
     417    }
     418     
    394419    ///Class to make a snapshot of the graph and to restrore to it later.
    395420
Note: See TracChangeset for help on using the changeset viewer.