\section{path\_\-iterator  Class Reference}
\label{class_path_iterator}\index{path_iterator@{path\_\-iterator}}
Collaboration diagram for path\_\-iterator:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=161pt]{class_path_iterator_coll_graph}
\end{center}
\end{figure}
\subsection*{Public Methods}
\begin{CompactItemize}
\item 
int {\bf bad} () const
\item 
int {\bf source} () const
\item 
int {\bf target} () const
\item 
int {\bf length} () const
\item 
void {\bf copy} (const path\_\-iterator \&{\bf pi})
\item 
const path\_\-iterator\& {\bf operator=} (const path\_\-iterator \&{\bf pi})
\item 
{\bf path\_\-iterator} (path\_\-iterator \&{\bf pi})
\item 
{\bf path\_\-iterator} ()
\item 
{\bf $\sim$path\_\-iterator} ()
\item 
const path\_\-iterator\& {\bf operator++} ()
\item 
{\bf operator int} () const
\item 
int$\ast$ {\bf operator $\ast$} () const
\item 
void {\bf reset} ()
\end{CompactItemize}
\subsection*{Private Methods}
\begin{CompactItemize}
\item 
{\bf path\_\-iterator} (const {\bf sd\-Graph}$<$ DT, WT $>$ $\ast$sdg, int s, int t, int k, {\bf DLList}$<$ int $>$ $\ast$const $\ast$tl, int($\ast$filter)(const {\bf sd\-Graph}$<$ DT, WT $>$ \&graph, const int $\ast$path, int ndx, int pathlen, void $\ast$arbitrary\_\-criteria), void $\ast$criteria)
\end{CompactItemize}
\subsection*{Private Attributes}
\begin{CompactItemize}
\item 
const {\bf sd\-Graph}$<$DT,WT$>$$\ast$ {\bf G}
\item 
int {\bf K}
\item 
int$\ast$ {\bf Path}
\item 
{\bf DLList}$<$int$>$::{\bf Iterator}$\ast$$\ast$ {\bf Trav}
\item 
int {\bf D}
\item 
int {\bf Done}
\item 
int {\bf Almost\-Done}
\item 
int ($\ast$ {\bf Filter} )(const {\bf sd\-Graph}$<$ DT, WT $>$ \&,const int $\ast$,int, int, void $\ast$)
\item 
void$\ast$ {\bf Criteria}
\end{CompactItemize}
\subsection*{Friends}
\begin{CompactItemize}
\item 
class {\bf sd\-Graph$<$ DT, WT $>$}
\end{CompactItemize}


\subsection{Constructor \& Destructor Documentation}
\index{path_iterator@{path\_\-iterator}!path_iterator@{path\_\-iterator}}
\index{path_iterator@{path\_\-iterator}!path_iterator@{path\_\-iterator}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}path\_\-iterator::path\_\-iterator (path\_\-iterator \& {\em pi})\hspace{0.3cm}{\tt  [inline]}}\label{class_path_iterator_a6}




Definition at line 405 of file sdgiter.inc.\footnotesize\begin{verbatim}00406                   { 
00407                     G = 0; K = -1; D = -1;
00408                     Done = 1; AlmostDone = 1;
00409                     Path = 0; Trav = 0;
00410                     Filter = 0;
00411                     Criteria = 0;
00412                     copy(pi); 
00413 \end{verbatim}\normalsize 
\index{path_iterator@{path\_\-iterator}!path_iterator@{path\_\-iterator}}
\index{path_iterator@{path\_\-iterator}!path_iterator@{path\_\-iterator}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}path\_\-iterator::path\_\-iterator ()\hspace{0.3cm}{\tt  [inline]}}\label{class_path_iterator_a7}




Definition at line 415 of file sdgiter.inc.\footnotesize\begin{verbatim}00416                   { 
00417                     G = 0; K = -1; D = -1;
00418                     Done = 1; AlmostDone = 1;
00419                     Path = 0; Trav = 0; Path = 0;
00420                     Filter = 0;
00421                     Criteria = 0;
00422 \end{verbatim}\normalsize 
\index{path_iterator@{path\_\-iterator}!~path_iterator@{$\sim$path\_\-iterator}}
\index{~path_iterator@{$\sim$path\_\-iterator}!path_iterator@{path\_\-iterator}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}path\_\-iterator::$\sim$path\_\-iterator ()\hspace{0.3cm}{\tt  [inline]}}\label{class_path_iterator_a8}




Definition at line 424 of file sdgiter.inc.\footnotesize\begin{verbatim}00425                   { 
00426                     delete[] Path;
00427                     for(int i=0; i<K-1; ++i) delete[] Trav[i];
00428                     delete[] Trav;
00429 \end{verbatim}\normalsize 
\index{path_iterator@{path\_\-iterator}!path_iterator@{path\_\-iterator}}
\index{path_iterator@{path\_\-iterator}!path_iterator@{path\_\-iterator}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}path\_\-iterator::path\_\-iterator (const {\bf sd\-Graph}$<$ DT, WT $>$ $\ast$ {\em sdg}, int {\em s}, int {\em t}, int {\em k}, {\bf DLList}$<$ int $>$ $\ast$const $\ast$ {\em tl}, int($\ast$ {\em filter})(const {\bf sd\-Graph}$<$ DT, WT $>$ \&graph,				const int $\ast$path,				int ndx, int pathlen,				void $\ast$arbitrary\_\-criteria), void $\ast$ {\em criteria})\hspace{0.3cm}{\tt  [inline, private]}}\label{class_path_iterator_c0}




Definition at line 562 of file sdgiter.inc.\footnotesize\begin{verbatim}00576                   {
00577                     int n = sdg->NumV;
00578                     G = 0; K = -1; D = -1; AlmostDone = Done = 1; 
00579                     Path = 0; Trav = 0;
00580 
00581                     if(k<0 || n<1 || s<0 || s>=n || t<0 || t>=n) return;
00582 
00583                     if(!tl && k>1) return;
00584 
00585                     if(!(Path = new int[k+1])) { return; }
00586 
00587                     if(k>1)
00588                       {
00589                         if(!(Trav = new DLList<int>::Iterator*[k-1]))
00590                           { delete[] Path; return; }
00591 
00592                         for(int i=0; i<k-1; ++i)
00593                           { 
00594                             if(!(Trav[i] = new DLList<int>::Iterator[n]))
00595                               {
00596                                 for(int j=0; j<=i; ++j)
00597                                   { delete[] Trav[j]; }
00598                                 delete[] Path; delete[] Trav;
00599                                 return;
00600                               }
00601                             for(int j=0; j<n; ++j)
00602                                 Trav[i][j] = tl[i][j].GetIterator();
00603                           }
00604                       }
00605 \end{verbatim}\normalsize 


\subsection{Member Function Documentation}
\index{path_iterator@{path\_\-iterator}!bad@{bad}}
\index{bad@{bad}!path_iterator@{path\_\-iterator}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int path\_\-iterator::bad () const\hspace{0.3cm}{\tt  [inline]}}\label{class_path_iterator_a0}




Definition at line 328 of file sdgiter.inc.

Referenced by copy().\footnotesize\begin{verbatim}00329                   { return (!G || !Path || (K>1 && !Trav)); }
00330 \end{verbatim}\normalsize 
\index{path_iterator@{path\_\-iterator}!copy@{copy}}
\index{copy@{copy}!path_iterator@{path\_\-iterator}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void path\_\-iterator::copy (const path\_\-iterator \& {\em pi})\hspace{0.3cm}{\tt  [inline]}}\label{class_path_iterator_a4}




Definition at line 335 of file sdgiter.inc.

Referenced by operator=(), and path\_\-iterator().\footnotesize\begin{verbatim}00336                   {
00337                     if(this == &pi) return;
00338 
00339                     if(pi.bad())
00340                       // If "pi" is bad then we make this iterator bad (copy
00341                       // a bad iterator to a good iterator makes the good 
00342                       // iterator bad!).
00343                       {
00344                         for(int i=0; i<K-1; ++i) delete[] Trav[i];
00345                         delete[] Trav; delete[] Path;
00346                         G=0; K=0; D=-1; Done=1;
00347                         return;
00348                       }
00349 
00350                     DLList<int>::Iterator ** tmpT = 0;
00351                     int * tmpP = 0;
00352 
00353                     if(G->NumV != pi.G->NumV || K!=pi.K)
00354                       // Have to resize our lists.
00355                       {
00356                         tmpT = Trav; tmpP = Path;
00357 
00358                         if(!(Path = new int[pi.K+1]))
00359                             { Path = tmpP; return; }
00360 
00361                         if(pi.K>1)
00362                           {
00363                             if(!(Trav = new DLList<int>::Iterator*[pi.K-1]))
00364                               { 
00365                                 delete[] Path; delete[] Trav;
00366                                 Path = tmpP; Trav = tmpT;
00367                                 return; 
00368                               }
00369                             for(int i=0; i<pi.K-1; ++i)
00370                               {
00371                        if(!(Trav[i] = new DLList<int>::Iterator[pi.G->NumV]))
00372                                 {
00373                                   for(int j=0; j<i; ++j) delete[] Trav[j];
00374                                   delete[] Path; delete[] Trav;
00375                                   Path = tmpP; Trav = tmpT;
00376                                   return;
00377                                 }
00378                               }
00379                           }
00380                         else Trav = 0;
00381 
00382                         if(K>1) for(int i=0; i<K-1; ++i) delete[] tmpT[i];
00383                         delete[] tmpP; delete[] tmpT;
00384                         G = pi.G; K = pi.K;
00385                       }
00386 
00387                     for(int i=0; i<K-1; ++i)
00388                       { 
00389                         for(int j=0; j<G->NumV; ++j)
00390                             Trav[i][j] = pi.Trav[i][j];
00391                         Path[i+1] = pi.Path[i+1];
00392                       }
00393 \end{verbatim}\normalsize 
\index{path_iterator@{path\_\-iterator}!length@{length}}
\index{length@{length}!path_iterator@{path\_\-iterator}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int path\_\-iterator::length () const\hspace{0.3cm}{\tt  [inline]}}\label{class_path_iterator_a3}




Definition at line 333 of file sdgiter.inc.\footnotesize\begin{verbatim}00333                                    { return K; }
00334 \end{verbatim}\normalsize 
\index{path_iterator@{path\_\-iterator}!operator *@{operator $\ast$}}
\index{operator *@{operator $\ast$}!path_iterator@{path\_\-iterator}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int $\ast$ path\_\-iterator::operator $\ast$ () const\hspace{0.3cm}{\tt  [inline]}}\label{class_path_iterator_a11}




Definition at line 536 of file sdgiter.inc.\footnotesize\begin{verbatim}00537                   {
00538                     int * current_path;
00539                     if(!(current_path = new int[K+1])) return 0;
00540                     for(int i=0; i<K+1; ++i) current_path[i] = Path[i];
00541                     return current_path;
00542 \end{verbatim}\normalsize 
\index{path_iterator@{path\_\-iterator}!operator int@{operator int}}
\index{operator int@{operator int}!path_iterator@{path\_\-iterator}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}path\_\-iterator::operator int () const\hspace{0.3cm}{\tt  [inline]}}\label{class_path_iterator_a10}




Definition at line 534 of file sdgiter.inc.\footnotesize\begin{verbatim}00534                                       { return !Done; }
00535 \end{verbatim}\normalsize 
\index{path_iterator@{path\_\-iterator}!operator++@{operator++}}
\index{operator++@{operator++}!path_iterator@{path\_\-iterator}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const path\_\-iterator \& path\_\-iterator::operator++ ()\hspace{0.3cm}{\tt  [inline]}}\label{class_path_iterator_a9}




Definition at line 431 of file sdgiter.inc.\footnotesize\begin{verbatim}00432                   {
00433         
00434                     int found, pre;
00435 
00436                     if(bad()) AlmostDone = 1;
00437                     if(AlmostDone) Done = 1;
00438                     if(Done) return *this;
00439 
00440                     if(K==0)
00441                       {
00442 #ifdef DEBUG
00443   ++PathsVisited;
00444 #endif
00445                         AlmostDone = 1;
00446                         if(D != Path[0]) Done = 1;
00447                         return *this;
00448                       }
00449 
00450                     if(K==1)
00451                       {
00452 #ifdef DEBUG
00453   ++PathsVisited;
00454 #endif
00455                         if(G->HasEdge(Path[0],Path[1]) &&
00456                           ((!Filter || !Filter(*G,Path,0,1,Criteria))))
00457                             AlmostDone=1;
00458                         else { AlmostDone = Done = 1; }
00459                         return *this;
00460                       }
00461 
00462                     // Backward stage of the iteration: build up a path
00463                     // from the end to the beginning.
00464                     // 
00465                     for(; D>=0; --D)
00466                       {
00467                         pre = Path[D+2];
00468 
00469                         if(!Trav[D][pre])
00470                           // If this happens it means no path exists.
00471                           { AlmostDone = Done = 1; return *this; }
00472 
00473                         for(found = 0; Trav[D][pre]; ++(Trav[D][pre]))
00474                           {
00475                             if(found) break;
00476 
00477                             Path[D+1] = *(Trav[D][pre]);
00478 
00479 #ifdef DEBUG
00480   ++PathsVisited;
00481 #endif
00482 
00483                             // Apply the filter to this path.  If the
00484                             // path is to be filtered, we assume all 
00485                             // paths containing the current path as a
00486                             // subset should not be expanded.  If this
00487                             // path should be filtered, we simply skip
00488                             // this and look for a different path.
00489                             // 
00490                             if(!Filter || !Filter(*G,Path,D+1,K,Criteria))
00491                                 found = 1;
00492                           }
00493 
00494                         if(!found)
00495                           // All the sub-paths got filtered so we need to back
00496                           // up to find another candidate sub-path.
00497                           {
00498                             for(; D<K-1; ++D)
00499                               {
00500                                 pre = Path[D+2];
00501                                 if(!Trav[D][pre]) Trav[D][pre].reset();
00502                                 else break;
00503                               }
00504 
00505                             // If we're at the beginning, then we must be
00506                             // done.
00507                             if(D==K-1)
00508                               { AlmostDone = Done = 1; return *this; }
00509                             else ++D;
00510                           }
00511                       }
00512                     
00513                     // Forward stage of the iteration: prepare the matrices
00514                     // for the next iteration.  We reset all the matrices/sets
00515                     // that are *completely* empty.  As soon as we reach a set
00516                     // that contains elements in it we stop.  This is the point
00517                     // where the next search will pick up.
00518 
00519                     for(D=0; D<K-1; ++D)
00520                       {
00521                         pre = Path[D+2];
00522                         if(!Trav[D][pre]) Trav[D][pre].reset();
00523                         else break;
00524                       }
00525 \end{verbatim}\normalsize 
\index{path_iterator@{path\_\-iterator}!operator=@{operator=}}
\index{operator=@{operator=}!path_iterator@{path\_\-iterator}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const path\_\-iterator \& path\_\-iterator::operator= (const path\_\-iterator \& {\em pi})\hspace{0.3cm}{\tt  [inline]}}\label{class_path_iterator_a5}




Definition at line 402 of file sdgiter.inc.\footnotesize\begin{verbatim}00403                   { copy(pi); return *this; }
00404 \end{verbatim}\normalsize 
\index{path_iterator@{path\_\-iterator}!reset@{reset}}
\index{reset@{reset}!path_iterator@{path\_\-iterator}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void path\_\-iterator::reset ()\hspace{0.3cm}{\tt  [inline]}}\label{class_path_iterator_a12}




Definition at line 544 of file sdgiter.inc.\footnotesize\begin{verbatim}00545                   {
00546                     if(K>1)
00547                       {
00548                         for(; D<K-1; ++D)
00549                             for(int i=0; i<G->NumV; ++i)
00550                                 Trav[D][i].reset();
00551                         D = K-2;
00552                       }
00553 \end{verbatim}\normalsize 
\index{path_iterator@{path\_\-iterator}!source@{source}}
\index{source@{source}!path_iterator@{path\_\-iterator}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int path\_\-iterator::source () const\hspace{0.3cm}{\tt  [inline]}}\label{class_path_iterator_a1}




Definition at line 331 of file sdgiter.inc.\footnotesize\begin{verbatim}00331                                    { return Path ? Path[0] : -1; }
00332 \end{verbatim}\normalsize 
\index{path_iterator@{path\_\-iterator}!target@{target}}
\index{target@{target}!path_iterator@{path\_\-iterator}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int path\_\-iterator::target () const\hspace{0.3cm}{\tt  [inline]}}\label{class_path_iterator_a2}




Definition at line 332 of file sdgiter.inc.\footnotesize\begin{verbatim}00332                                    { return Path ? Path[K] : -1; }
00333 \end{verbatim}\normalsize 


\subsection{Friends And Related Function Documentation}
\index{path_iterator@{path\_\-iterator}!sdGraph< DT, WT >@{sdGraph$<$ DT, WT $>$}}
\index{sdGraph< DT, WT >@{sdGraph$<$ DT, WT $>$}!path_iterator@{path\_\-iterator}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}class {\bf sd\-Graph}\hspace{0.3cm}{\tt  [friend]}}\label{class_path_iterator_l0}




Definition at line 326 of file sdgiter.inc.

\subsection{Member Data Documentation}
\index{path_iterator@{path\_\-iterator}!AlmostDone@{AlmostDone}}
\index{AlmostDone@{AlmostDone}!path_iterator@{path\_\-iterator}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int path\_\-iterator::Almost\-Done\hspace{0.3cm}{\tt  [private]}}\label{class_path_iterator_o6}




Definition at line 627 of file sdgiter.inc.\index{path_iterator@{path\_\-iterator}!Criteria@{Criteria}}
\index{Criteria@{Criteria}!path_iterator@{path\_\-iterator}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void $\ast$ path\_\-iterator::Criteria\hspace{0.3cm}{\tt  [private]}}\label{class_path_iterator_o8}




Definition at line 633 of file sdgiter.inc.\index{path_iterator@{path\_\-iterator}!D@{D}}
\index{D@{D}!path_iterator@{path\_\-iterator}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int path\_\-iterator::D\hspace{0.3cm}{\tt  [private]}}\label{class_path_iterator_o4}




Definition at line 624 of file sdgiter.inc.\index{path_iterator@{path\_\-iterator}!Done@{Done}}
\index{Done@{Done}!path_iterator@{path\_\-iterator}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int path\_\-iterator::Done\hspace{0.3cm}{\tt  [private]}}\label{class_path_iterator_o5}




Definition at line 625 of file sdgiter.inc.\index{path_iterator@{path\_\-iterator}!Filter@{Filter}}
\index{Filter@{Filter}!path_iterator@{path\_\-iterator}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ($\ast$ path\_\-iterator::Filter)(const {\bf sd\-Graph}$<$DT,WT$>$\&,const int$\ast$,int,int,void$\ast$)\hspace{0.3cm}{\tt  [private]}}\label{class_path_iterator_o7}




Referenced by operator++().\index{path_iterator@{path\_\-iterator}!G@{G}}
\index{G@{G}!path_iterator@{path\_\-iterator}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const {\bf sd\-Graph}$<$ DT, WT $>$ $\ast$ path\_\-iterator::G\hspace{0.3cm}{\tt  [private]}}\label{class_path_iterator_o0}




Definition at line 618 of file sdgiter.inc.\index{path_iterator@{path\_\-iterator}!K@{K}}
\index{K@{K}!path_iterator@{path\_\-iterator}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int path\_\-iterator::K\hspace{0.3cm}{\tt  [private]}}\label{class_path_iterator_o1}




Definition at line 619 of file sdgiter.inc.\index{path_iterator@{path\_\-iterator}!Path@{Path}}
\index{Path@{Path}!path_iterator@{path\_\-iterator}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int $\ast$ path\_\-iterator::Path\hspace{0.3cm}{\tt  [private]}}\label{class_path_iterator_o2}




Definition at line 620 of file sdgiter.inc.\index{path_iterator@{path\_\-iterator}!Trav@{Trav}}
\index{Trav@{Trav}!path_iterator@{path\_\-iterator}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf DLList}$<$ int $>$::{\bf Iterator} $\ast$$\ast$ path\_\-iterator::Trav\hspace{0.3cm}{\tt  [private]}}\label{class_path_iterator_o3}




Definition at line 621 of file sdgiter.inc.

The documentation for this class was generated from the following file:\begin{CompactItemize}
\item 
{\bf sdgiter.inc}\end{CompactItemize}
