| ... | ... | 
		@@ -40,13 +40,13 @@  | 
| 40 | 40 | 
		/// \brief A structure for representing directed paths in a digraph.  | 
| 41 | 41 | 
		///  | 
| 42 | 42 | 
		/// A structure for representing directed path in a digraph.  | 
| 43 | 43 | 
		/// \tparam GR The digraph type in which the path is.  | 
| 44 | 44 | 
		///  | 
| 45 | 45 | 
		/// In a sense, the path can be treated as a list of arcs. The  | 
| 46 | 
		///  | 
|
| 46 | 
		/// LEMON path type stores just this list. As a consequence, it  | 
|
| 47 | 47 | 
		/// cannot enumerate the nodes of the path and the source node of  | 
| 48 | 48 | 
		/// a zero length path is undefined.  | 
| 49 | 49 | 
		///  | 
| 50 | 50 | 
		/// This implementation is a back and front insertable and erasable  | 
| 51 | 51 | 
		/// path type. It can be indexed in O(1) time. The front and back  | 
| 52 | 52 | 
		/// insertion and erase is done in O(1) (amortized) time. The  | 
| ... | ... | 
		@@ -132,21 +132,21 @@  | 
| 132 | 132 | 
		/// \brief Return whether the path is empty.  | 
| 133 | 133 | 
		    bool empty() const { return head.empty() && tail.empty(); }
	 | 
| 134 | 134 | 
		 | 
| 135 | 135 | 
		/// \brief Reset the path to an empty one.  | 
| 136 | 136 | 
		    void clear() { head.clear(); tail.clear(); }
	 | 
| 137 | 137 | 
		 | 
| 138 | 
		/// \brief The  | 
|
| 138 | 
		/// \brief The n-th arc.  | 
|
| 139 | 139 | 
		///  | 
| 140 | 140 | 
		/// \pre \c n is in the <tt>[0..length() - 1]</tt> range.  | 
| 141 | 141 | 
		    const Arc& nth(int n) const {
	 | 
| 142 | 142 | 
		return n < int(head.size()) ? *(head.rbegin() + n) :  | 
| 143 | 143 | 
		*(tail.begin() + (n - head.size()));  | 
| 144 | 144 | 
		}  | 
| 145 | 145 | 
		 | 
| 146 | 
		/// \brief Initialize arc iterator to point to the  | 
|
| 146 | 
		/// \brief Initialize arc iterator to point to the n-th arc  | 
|
| 147 | 147 | 
		///  | 
| 148 | 148 | 
		/// \pre \c n is in the <tt>[0..length() - 1]</tt> range.  | 
| 149 | 149 | 
		    ArcIt nthIt(int n) const {
	 | 
| 150 | 150 | 
		return ArcIt(*this, n);  | 
| 151 | 151 | 
		}  | 
| 152 | 152 | 
		 | 
| ... | ... | 
		@@ -228,13 +228,13 @@  | 
| 228 | 228 | 
		/// \brief A structure for representing directed paths in a digraph.  | 
| 229 | 229 | 
		///  | 
| 230 | 230 | 
		/// A structure for representing directed path in a digraph.  | 
| 231 | 231 | 
		/// \tparam GR The digraph type in which the path is.  | 
| 232 | 232 | 
		///  | 
| 233 | 233 | 
		/// In a sense, the path can be treated as a list of arcs. The  | 
| 234 | 
		///  | 
|
| 234 | 
		/// LEMON path type stores just this list. As a consequence it  | 
|
| 235 | 235 | 
		/// cannot enumerate the nodes in the path and the zero length paths  | 
| 236 | 236 | 
		/// cannot store the source.  | 
| 237 | 237 | 
		///  | 
| 238 | 238 | 
		/// This implementation is a just back insertable and erasable path  | 
| 239 | 239 | 
		/// type. It can be indexed in O(1) time. The back insertion and  | 
| 240 | 240 | 
		/// erasure is amortized O(1) time. This implementation is faster  | 
| ... | ... | 
		@@ -324,20 +324,20 @@  | 
| 324 | 324 | 
		/// \brief Return true if the path is empty.  | 
| 325 | 325 | 
		    bool empty() const { return data.empty(); }
	 | 
| 326 | 326 | 
		 | 
| 327 | 327 | 
		/// \brief Reset the path to an empty one.  | 
| 328 | 328 | 
		    void clear() { data.clear(); }
	 | 
| 329 | 329 | 
		 | 
| 330 | 
		/// \brief The  | 
|
| 330 | 
		/// \brief The n-th arc.  | 
|
| 331 | 331 | 
		///  | 
| 332 | 332 | 
		/// \pre \c n is in the <tt>[0..length() - 1]</tt> range.  | 
| 333 | 333 | 
		    const Arc& nth(int n) const {
	 | 
| 334 | 334 | 
		return data[n];  | 
| 335 | 335 | 
		}  | 
| 336 | 336 | 
		 | 
| 337 | 
		/// \brief Initializes arc iterator to point to the  | 
|
| 337 | 
		/// \brief Initializes arc iterator to point to the n-th arc.  | 
|
| 338 | 338 | 
		    ArcIt nthIt(int n) const {
	 | 
| 339 | 339 | 
		return ArcIt(*this, n);  | 
| 340 | 340 | 
		}  | 
| 341 | 341 | 
		 | 
| 342 | 342 | 
		/// \brief The first arc of the path.  | 
| 343 | 343 | 
		    const Arc& front() const {
	 | 
| ... | ... | 
		@@ -392,13 +392,13 @@  | 
| 392 | 392 | 
		/// \brief A structure for representing directed paths in a digraph.  | 
| 393 | 393 | 
		///  | 
| 394 | 394 | 
		/// A structure for representing directed path in a digraph.  | 
| 395 | 395 | 
		/// \tparam GR The digraph type in which the path is.  | 
| 396 | 396 | 
		///  | 
| 397 | 397 | 
		/// In a sense, the path can be treated as a list of arcs. The  | 
| 398 | 
		///  | 
|
| 398 | 
		/// LEMON path type stores just this list. As a consequence it  | 
|
| 399 | 399 | 
		/// cannot enumerate the nodes in the path and the zero length paths  | 
| 400 | 400 | 
		/// cannot store the source.  | 
| 401 | 401 | 
		///  | 
| 402 | 402 | 
		/// This implementation is a back and front insertable and erasable  | 
| 403 | 403 | 
		/// path type. It can be indexed in O(k) time, where k is the rank  | 
| 404 | 404 | 
		/// of the arc in the path. The length can be computed in O(n)  | 
| ... | ... | 
		@@ -501,25 +501,25 @@  | 
| 501 | 501 | 
		 | 
| 502 | 502 | 
		private:  | 
| 503 | 503 | 
		const ListPath *path;  | 
| 504 | 504 | 
		Node *node;  | 
| 505 | 505 | 
		};  | 
| 506 | 506 | 
		 | 
| 507 | 
		/// \brief The  | 
|
| 507 | 
		/// \brief The n-th arc.  | 
|
| 508 | 508 | 
		///  | 
| 509 | 
		/// This function looks for the  | 
|
| 509 | 
		/// This function looks for the n-th arc in O(n) time.  | 
|
| 510 | 510 | 
		/// \pre \c n is in the <tt>[0..length() - 1]</tt> range.  | 
| 511 | 511 | 
		    const Arc& nth(int n) const {
	 | 
| 512 | 512 | 
		Node *node = first;  | 
| 513 | 513 | 
		      for (int i = 0; i < n; ++i) {
	 | 
| 514 | 514 | 
		node = node->next;  | 
| 515 | 515 | 
		}  | 
| 516 | 516 | 
		return node->arc;  | 
| 517 | 517 | 
		}  | 
| 518 | 518 | 
		 | 
| 519 | 
		/// \brief Initializes arc iterator to point to the  | 
|
| 519 | 
		/// \brief Initializes arc iterator to point to the n-th arc.  | 
|
| 520 | 520 | 
		    ArcIt nthIt(int n) const {
	 | 
| 521 | 521 | 
		Node *node = first;  | 
| 522 | 522 | 
		      for (int i = 0; i < n; ++i) {
	 | 
| 523 | 523 | 
		node = node->next;  | 
| 524 | 524 | 
		}  | 
| 525 | 525 | 
		return ArcIt(*this, node);  | 
| ... | ... | 
		@@ -732,13 +732,13 @@  | 
| 732 | 732 | 
		/// \brief A structure for representing directed paths in a digraph.  | 
| 733 | 733 | 
		///  | 
| 734 | 734 | 
		/// A structure for representing directed path in a digraph.  | 
| 735 | 735 | 
		/// \tparam GR The digraph type in which the path is.  | 
| 736 | 736 | 
		///  | 
| 737 | 737 | 
		/// In a sense, the path can be treated as a list of arcs. The  | 
| 738 | 
		///  | 
|
| 738 | 
		/// LEMON path type stores just this list. As a consequence it  | 
|
| 739 | 739 | 
		/// cannot enumerate the nodes in the path and the source node of  | 
| 740 | 740 | 
		/// a zero length path is undefined.  | 
| 741 | 741 | 
		///  | 
| 742 | 742 | 
		/// This implementation is completly static, i.e. it can be copy constucted  | 
| 743 | 743 | 
		/// or copy assigned from another path, but otherwise it cannot be  | 
| 744 | 744 | 
		/// modified.  | 
| ... | ... | 
		@@ -828,20 +828,20 @@  | 
| 828 | 828 | 
		 | 
| 829 | 829 | 
		private:  | 
| 830 | 830 | 
		const StaticPath *path;  | 
| 831 | 831 | 
		int idx;  | 
| 832 | 832 | 
		};  | 
| 833 | 833 | 
		 | 
| 834 | 
		/// \brief The  | 
|
| 834 | 
		/// \brief The n-th arc.  | 
|
| 835 | 835 | 
		///  | 
| 836 | 836 | 
		/// \pre \c n is in the <tt>[0..length() - 1]</tt> range.  | 
| 837 | 837 | 
		    const Arc& nth(int n) const {
	 | 
| 838 | 838 | 
		return arcs[n];  | 
| 839 | 839 | 
		}  | 
| 840 | 840 | 
		 | 
| 841 | 
		/// \brief The arc iterator pointing to the  | 
|
| 841 | 
		/// \brief The arc iterator pointing to the n-th arc.  | 
|
| 842 | 842 | 
		    ArcIt nthIt(int n) const {
	 | 
| 843 | 843 | 
		return ArcIt(*this, n);  | 
| 844 | 844 | 
		}  | 
| 845 | 845 | 
		 | 
| 846 | 846 | 
		/// \brief The length of the path.  | 
| 847 | 847 | 
		    int length() const { return len; }
	 | 
| ... | ... | 
		@@ -1039,13 +1039,13 @@  | 
| 1039 | 1039 | 
		return path.empty() ? INVALID : digraph.target(path.back());  | 
| 1040 | 1040 | 
		}  | 
| 1041 | 1041 | 
		 | 
| 1042 | 1042 | 
		/// \brief Class which helps to iterate through the nodes of a path  | 
| 1043 | 1043 | 
		///  | 
| 1044 | 1044 | 
		/// In a sense, the path can be treated as a list of arcs. The  | 
| 1045 | 
		///  | 
|
| 1045 | 
		/// LEMON path type stores only this list. As a consequence, it  | 
|
| 1046 | 1046 | 
		/// cannot enumerate the nodes in the path and the zero length paths  | 
| 1047 | 1047 | 
		/// cannot have a source node.  | 
| 1048 | 1048 | 
		///  | 
| 1049 | 1049 | 
		/// This class implements the node iterator of a path structure. To  | 
| 1050 | 1050 | 
		/// provide this feature, the underlying digraph should be passed to  | 
| 1051 | 1051 | 
		/// the constructor of the iterator.  | 
0 comments (0 inline)