HOG2
Path.h
Go to the documentation of this file.
1 /*
2  * $Id: path.h
3  * hog2
4  *
5  * Created by Nathan Sturtevant on 9/28/04.
6  * Modified by Nathan Sturtevant on 02/29/20.
7  *
8  * This file is part of HOG2. See https://github.com/nathansttt/hog2 for licensing information.
9  *
10  */
11 
12 #ifndef PATH_H
13 #define PATH_H
14 
15 #include "Graph.h"
16 
20 class path {
21 public:
22  node *n;
24 
25  path(node *_n, path *_next=0) : n(_n), next(_next) {}
26  ~path() { if (next != NULL) delete next; }
27  path *Clone() { return next?(new path(n, next->Clone())):new path(n, next);}
28  path *tail() { if (next) return next->tail(); return this; }
30  path *reverse();
32  unsigned length(void);
33 // /** returns the distance covered by the path */
34 // double distance(GraphAbstraction* aMap);
35  unsigned degree();
36  void Print(bool beginning=true);
37 };
38 
39 #endif
Graph.h
path::n
node * n
Definition: Path.h:22
path::path
path(node *_n, path *_next=0)
Definition: Path.h:25
path::Print
void Print(bool beginning=true)
Definition: Path.cpp:44
path::Clone
path * Clone()
Definition: Path.h:27
path::length
unsigned length(void)
returns the number of steps along the path
Definition: Path.cpp:15
path::degree
unsigned degree()
Definition: Path.cpp:33
path::tail
path * tail()
Definition: Path.h:28
path::next
path * next
Definition: Path.h:23
path
A linked list of nodes which form a continuous path.
Definition: Path.h:20
path::~path
~path()
Definition: Path.h:26
node
Nodes to be stored within a Graph.
Definition: Graph.h:170
path::reverse
path * reverse()
reverses path in place, and returns pointer to new head of path
Definition: Path.cpp:62