Search Grid
AUVSI Search Path Algorithm 2019-2021
Public Member Functions | Public Attributes | List of all members
Graph< E, W > Struct Template Reference

A simple weighted directed graph. More...

Public Member Functions

 Graph (const unsigned int n)
 Construct the graph with a specified number of vertices. More...
 
 Graph (const unsigned int n, E *verts)
 Construct the graph with an existing list of vertices. More...
 
 ~Graph ()
 Destructor.
 
E * prev (int vert)
 Get an arbitrary previous vertex. More...
 
E * next (int vert)
 Get an arbitrary next vertex. More...
 
void setEdge (const unsigned int v1, const unsigned int v2)
 Add an edge to the graph. More...
 
void removeEdge (const unsigned int v1, const unsigned int v2)
 Remove an edge from the graph. More...
 
unsigned int size () const
 Get the max number of vertices in the graph. More...
 

Public Attributes

const unsigned int numVerts
 The number of vertices stored in the graph.
 
E * v
 The list of vertices.
 
bool ** e
 Adjacency matrix representing edges in the graph.
 
W ** w
 Weight matrix for each directional edge.
 

Detailed Description

template<typename E, typename W>
struct Graph< E, W >

A simple weighted directed graph.

Constructor & Destructor Documentation

◆ Graph() [1/2]

template<typename E , typename W >
Graph< E, W >::Graph ( const unsigned int  n)
inline

Construct the graph with a specified number of vertices.

Parameters
nnumber of vertices in the graph

◆ Graph() [2/2]

template<typename E , typename W >
Graph< E, W >::Graph ( const unsigned int  n,
E *  verts 
)
inline

Construct the graph with an existing list of vertices.

Parameters
nnumber of vertices in the graph
vertslist of vertices

Member Function Documentation

◆ next()

template<typename E , typename W >
E* Graph< E, W >::next ( int  vert)
inline

Get an arbitrary next vertex.

Parameters
vertindex of vertex
Returns
returns pointer to an arbitrary next vertex or NULL if there is none

◆ prev()

template<typename E , typename W >
E* Graph< E, W >::prev ( int  vert)
inline

Get an arbitrary previous vertex.

Parameters
vertindex of vertex
Returns
returns pointer to an arbitrary previous vertex or NULL if there is none

◆ removeEdge()

template<typename E , typename W >
void Graph< E, W >::removeEdge ( const unsigned int  v1,
const unsigned int  v2 
)
inline

Remove an edge from the graph.

Parameters
v1index of first vertex of edge
v2index of second vertex of edge

◆ setEdge()

template<typename E , typename W >
void Graph< E, W >::setEdge ( const unsigned int  v1,
const unsigned int  v2 
)
inline

Add an edge to the graph.

Parameters
v1index of first vertex of edge
v2index of second vertex of edge

◆ size()

template<typename E , typename W >
unsigned int Graph< E, W >::size ( ) const
inline

Get the max number of vertices in the graph.

Returns
the number of vertices

The documentation for this struct was generated from the following file: