COIN-OR::LEMON - Graph Library

Changeset 1284:b941d044f87b in lemon-0.x for src/lemon


Ignore:
Timestamp:
03/31/05 16:04:13 (19 years ago)
Author:
Alpar Juttner
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1716
Message:

SmartGraph? can also split() a node!

Location:
src/lemon
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/lemon/list_graph.h

    r1281 r1284  
    393393    ///Split a node.
    394394
    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.
     395    ///This function splits a node. First a new node is added to the graph,
     396    ///then the source of each outgoing edge of \c n is moved to this new node.
    397397    ///If \c connect is \c true (this is the default value), then a new edge
    398398    ///from \c n to the newly created node is also added.
     
    403403    ///valid. However <tt>InEdge</tt>'s and <tt>OutEdge</tt>'s
    404404    ///may be invalidated.
     405    ///\warning This functionality cannot be used together with the SnapShot
     406    ///feature.
    405407    ///\todo It could be implemented in a bit faster way.
    406408    Node split(Node n, bool connect = true)
  • src/lemon/smart_graph.h

    r1274 r1284  
    220220    }
    221221
     222    Node _split(Node n, bool connect = true)
     223    {
     224      Node b = addNode();
     225      nodes[b.n].first_out=nodes[n.n].first_out;
     226      nodes[n.n].first_out=-1;
     227      for(int i=nodes[b.n].first_out;i!=-1;i++) edges[i].source=b.n;
     228      if(connect) addEdge(n,b);
     229      return b;
     230    }
     231
    222232  };
    223233
     
    285295
    286296  public:
     297
     298    ///Split a node.
     299   
     300    ///This function splits a node. First a new node is added to the graph,
     301    ///then the source of each outgoing edge of \c n is moved to this new node.
     302    ///If \c connect is \c true (this is the default value), then a new edge
     303    ///from \c n to the newly created node is also added.
     304    ///\return The newly created node.
     305    ///
     306    ///\note The <tt>Edge</tt>s
     307    ///referencing a moved edge remain
     308    ///valid. However <tt>InEdge</tt>'s and <tt>OutEdge</tt>'s
     309    ///may be invalidated.
     310    ///\warning This functionality cannot be used together with the SnapShot
     311    ///feature.
     312    ///\todo It could be implemented in a bit faster way.
     313    Node split(Node n, bool connect = true)
     314    {
     315      return _split(n,connect);
     316    }
     317 
     318
    287319    ///Class to make a snapshot of the graph and to restrore to it later.
    288320
Note: See TracChangeset for help on using the changeset viewer.