Changeset 948:bc86b64f958e in lemon0.x for src/lemon/list_graph.h
 Timestamp:
 10/30/04 18:30:12 (16 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@1328
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

src/lemon/list_graph.h
r946 r948 1 // * c++ * 1 /* * C++ * 2 * src/lemon/list_graph.h  Part of LEMON, a generic C++ optimization library 3 * 4 * Copyright (C) 2004 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 5 * (Egervary Combinatorial Optimization Research Group, EGRES). 6 * 7 * Permission to use, modify and distribute this software is granted 8 * provided that this copyright notice appears in all copies. For 9 * precise terms see the accompanying LICENSE file. 10 * 11 * This software is provided "AS IS" with no warranty of any kind, 12 * express or implied, and with no claim as to its suitability for any 13 * purpose. 14 * 15 */ 2 16 3 17 #ifndef LEMON_LIST_GRAPH_H 4 18 #define LEMON_LIST_GRAPH_H 19 20 ///\ingroup graphs 21 ///\file 22 ///\brief ListGraph, SymListGraph, NodeSet and EdgeSet classes. 5 23 6 24 #include <lemon/erasable_graph_extender.h> … … 83 101 84 102 85 ///it possible to avoid the superfluous memory allocation. 103 ///Using this it possible to avoid the superfluous memory allocation. 104 ///\todo more docs... 105 ///\todo It should be defined in ListGraph. 86 106 void reserveEdge(int n) { edges.reserve(n); }; 87 107 … … 268 288 typedef ErasableGraphExtender<ClearableListGraphBase> ErasableListGraphBase; 269 289 270 typedef ErasableListGraphBase ListGraph; 271 272 } 273 274 290 /// \addtogroup graphs 291 /// @{ 292 293 ///A list graph class. 294 295 ///This is a simple and fast erasable graph implementation. 296 /// 297 ///It conforms to the 298 ///\ref skeleton::ErasableGraph "ErasableGraph" concept. 299 ///\sa skeleton::ErasableGraph. 300 301 class ListGraph : public ErasableListGraphBase 302 { 303 public: 304 /// Moves the head of \c e to \c n 305 306 /// Moves the head of \c e to \c n 307 /// 308 void moveHead(Edge e, Node n) 309 { 310 if(edges[e.n].next_in != 1) 311 edges[edges[e.n].next_in].prev_in = edges[e.n].prev_in; 312 if(edges[e.n].prev_in != 1) 313 edges[edges[e.n].prev_in].next_in = edges[e.n].next_in; 314 else nodes[edges[e.n].head].first_in = edges[e.n].next_in; 315 edges[e.n].head = n.n; 316 edges[e.n].prev_in = 1; 317 edges[e.n].next_in = nodes[n.n].first_in; 318 nodes[n.n].first_in = e.n; 319 } 320 /// Moves the tail of \c e to \c n 321 322 /// Moves the tail of \c e to \c n 323 /// 324 void moveTail(Edge e, Node n) 325 { 326 if(edges[e.n].next_out != 1) 327 edges[edges[e.n].next_out].prev_out = edges[e.n].prev_out; 328 if(edges[e.n].prev_out != 1) 329 edges[edges[e.n].prev_out].next_out = edges[e.n].next_out; 330 else nodes[edges[e.n].tail].first_out = edges[e.n].next_out; 331 edges[e.n].tail = n.n; 332 edges[e.n].prev_out = 1; 333 edges[e.n].next_out = nodes[n.n].first_out; 334 nodes[n.n].first_out = e.n; 335 } 336 } 337 /// @} 338 } //namespace lemon 275 339 276 340
Note: See TracChangeset
for help on using the changeset viewer.