\hypertarget{class_odin_a_i_1_1_dijkstra_graph_search}{\section{Odin\-A\-I\-:\-:Dijkstra\-Graph\-Search$<$ Graph\-Type, Target\-Condition $>$ Class Template Reference}
\label{class_odin_a_i_1_1_dijkstra_graph_search}\index{Odin\-A\-I\-::\-Dijkstra\-Graph\-Search$<$ Graph\-Type, Target\-Condition $>$@{Odin\-A\-I\-::\-Dijkstra\-Graph\-Search$<$ Graph\-Type, Target\-Condition $>$}}
}


Given a graph, and an optional target, it calculates the shortest path from the source node to the target.  




{\ttfamily \#include $<$Dijkstra\-Graph\-Search.\-h$>$}

\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\hypertarget{class_odin_a_i_1_1_dijkstra_graph_search_a54308aaaa18e85b240b6d68302d06ce3}{{\bfseries Dijkstra\-Graph\-Search} (const Graph\-Type \&graph, int source, int target=-\/1)}\label{class_odin_a_i_1_1_dijkstra_graph_search_a54308aaaa18e85b240b6d68302d06ce3}

\item 
std\-::vector$<$ const Edge $\ast$ $>$ \hyperlink{class_odin_a_i_1_1_dijkstra_graph_search_afa15c3fe59be95eaede8c5294fd6c2f3}{Get\-S\-P\-T} () const 
\item 
std\-::list$<$ int $>$ \hyperlink{class_odin_a_i_1_1_dijkstra_graph_search_a7885616a3e11a9faaf4140f1deb9d73e}{Get\-Path} () const 
\item 
int \hyperlink{class_odin_a_i_1_1_dijkstra_graph_search_acd254382b9487db90d26861a4f45ab48}{Get\-Cost\-To\-Target} () const 
\item 
int \hyperlink{class_odin_a_i_1_1_dijkstra_graph_search_a1a02b29d75af1a7de55f5d8591183b89}{Get\-Cost\-To\-Node} (unsigned int nd) const 
\end{DoxyCompactItemize}


\subsection{Detailed Description}
\subsubsection*{template$<$class Graph\-Type, class Target\-Condition = int$>$class Odin\-A\-I\-::\-Dijkstra\-Graph\-Search$<$ Graph\-Type, Target\-Condition $>$}

Given a graph, and an optional target, it calculates the shortest path from the source node to the target. 

The target maybe anything, it maybe a node, or it maybe a condition. Set target condition to your own class with a static function bool Is\-Target, where the first argument should be a const graph reference, and the second an int, for the current node id. Below is an example\-: 
\begin{DoxyCodeInclude}

\textcolor{keyword}{class }TargetCondition
\{
\textcolor{keyword}{public}:
    TargetCondition(\textcolor{keywordtype}{int} target) : m\_target(target) \{\}

    \textcolor{keywordtype}{int} m\_target;

    \textcolor{keyword}{template}<\textcolor{keyword}{class} GraphType>
    \textcolor{keyword}{static} \textcolor{keywordtype}{bool} IsTarget(\textcolor{keyword}{const} GraphType &graph, \textcolor{keywordtype}{int} nodeID)
    \{
        \textcolor{keywordflow}{return} m\_target == nodeID;
    \}
\};
\end{DoxyCodeInclude}
 

\subsection{Member Function Documentation}
\hypertarget{class_odin_a_i_1_1_dijkstra_graph_search_a1a02b29d75af1a7de55f5d8591183b89}{\index{Odin\-A\-I\-::\-Dijkstra\-Graph\-Search@{Odin\-A\-I\-::\-Dijkstra\-Graph\-Search}!Get\-Cost\-To\-Node@{Get\-Cost\-To\-Node}}
\index{Get\-Cost\-To\-Node@{Get\-Cost\-To\-Node}!OdinAI::DijkstraGraphSearch@{Odin\-A\-I\-::\-Dijkstra\-Graph\-Search}}
\subsubsection[{Get\-Cost\-To\-Node}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class Graph\-Type , class Target\-Condition  = int$>$ int {\bf Odin\-A\-I\-::\-Dijkstra\-Graph\-Search}$<$ Graph\-Type, Target\-Condition $>$\-::Get\-Cost\-To\-Node (
\begin{DoxyParamCaption}
\item[{unsigned int}]{nd}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily [inline]}}}\label{class_odin_a_i_1_1_dijkstra_graph_search_a1a02b29d75af1a7de55f5d8591183b89}
Get cost to any node. N\-O\-T\-E it will only work if the node is on the S\-P\-T tree. \begin{DoxyReturn}{Returns}
Cost from source node to this node. 
\end{DoxyReturn}
\hypertarget{class_odin_a_i_1_1_dijkstra_graph_search_acd254382b9487db90d26861a4f45ab48}{\index{Odin\-A\-I\-::\-Dijkstra\-Graph\-Search@{Odin\-A\-I\-::\-Dijkstra\-Graph\-Search}!Get\-Cost\-To\-Target@{Get\-Cost\-To\-Target}}
\index{Get\-Cost\-To\-Target@{Get\-Cost\-To\-Target}!OdinAI::DijkstraGraphSearch@{Odin\-A\-I\-::\-Dijkstra\-Graph\-Search}}
\subsubsection[{Get\-Cost\-To\-Target}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class Graph\-Type , class Target\-Condition  = int$>$ int {\bf Odin\-A\-I\-::\-Dijkstra\-Graph\-Search}$<$ Graph\-Type, Target\-Condition $>$\-::Get\-Cost\-To\-Target (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily [inline]}}}\label{class_odin_a_i_1_1_dijkstra_graph_search_acd254382b9487db90d26861a4f45ab48}
Get cost to our target. \begin{DoxyReturn}{Returns}
Cost to our target. 
\end{DoxyReturn}
\hypertarget{class_odin_a_i_1_1_dijkstra_graph_search_a7885616a3e11a9faaf4140f1deb9d73e}{\index{Odin\-A\-I\-::\-Dijkstra\-Graph\-Search@{Odin\-A\-I\-::\-Dijkstra\-Graph\-Search}!Get\-Path@{Get\-Path}}
\index{Get\-Path@{Get\-Path}!OdinAI::DijkstraGraphSearch@{Odin\-A\-I\-::\-Dijkstra\-Graph\-Search}}
\subsubsection[{Get\-Path}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class Graph\-Type , class Target\-Condition $>$ std\-::list$<$ int $>$ {\bf Odin\-A\-I\-::\-Dijkstra\-Graph\-Search}$<$ Graph\-Type, Target\-Condition $>$\-::Get\-Path (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const}}\label{class_odin_a_i_1_1_dijkstra_graph_search_a7885616a3e11a9faaf4140f1deb9d73e}
Get the path. The list is empty if no path found. \begin{DoxyReturn}{Returns}
The path represented as a list with the nodes that you must traverse between. 
\end{DoxyReturn}
\hypertarget{class_odin_a_i_1_1_dijkstra_graph_search_afa15c3fe59be95eaede8c5294fd6c2f3}{\index{Odin\-A\-I\-::\-Dijkstra\-Graph\-Search@{Odin\-A\-I\-::\-Dijkstra\-Graph\-Search}!Get\-S\-P\-T@{Get\-S\-P\-T}}
\index{Get\-S\-P\-T@{Get\-S\-P\-T}!OdinAI::DijkstraGraphSearch@{Odin\-A\-I\-::\-Dijkstra\-Graph\-Search}}
\subsubsection[{Get\-S\-P\-T}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class Graph\-Type , class Target\-Condition  = int$>$ std\-::vector$<$const Edge$\ast$$>$ {\bf Odin\-A\-I\-::\-Dijkstra\-Graph\-Search}$<$ Graph\-Type, Target\-Condition $>$\-::Get\-S\-P\-T (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily [inline]}}}\label{class_odin_a_i_1_1_dijkstra_graph_search_afa15c3fe59be95eaede8c5294fd6c2f3}
Get our shortest path tree, in other words the shortest path from any node to any node. \begin{DoxyReturn}{Returns}
The shortest path tree. 
\end{DoxyReturn}


The documentation for this class was generated from the following file\-:\begin{DoxyCompactItemize}
\item 
E\-:/\-Development/\-Projects/\-Odin\-A\-I/\-Include/\-Odin\-A\-I/Dijkstra\-Graph\-Search.\-h\end{DoxyCompactItemize}
