OdinAI

- Main Page
- Namespaces
- Classes
- Files
- Examples

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Functions Variables
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
OdinAI::SparseGraph< NODE_TYPE, EDGE_TYPE > Class Template Reference

`#include <SparseGraph.h>`

## Classes
class | ConstEdgeIterator
class | ConstNodeIterator
class | EdgeIterator
class | NodeIterator

## Public Types
typedef NODE_TYPE | NodeType
typedef EDGE_TYPE | EdgeType
typedef std::vector< NODE_TYPE > | NodeVector
typedef std::list< EDGE_TYPE > | EdgeList
typedef std::vector< EdgeList > | EdgeListVector

## Public Member Functions
| SparseGraph (bool digraph)
const NodeType & | GetNode (int index) const
NodeType & | GetNode (int index)
const EdgeType & | GetEdge (int from, int to) const
EdgeType & | GetEdge (int from, int to)
int | GetNextNodeIndex () const
int | AddNode (const NodeType &node)
void | RemoveNode (int node)
void | AddEdge (const EdgeType &edge)
void | RemoveEdge (int from, int to)
int | NumNodes () const
int | NumActiveNodes () const
int | NumEdges () const
bool | IsDigraph () const
bool | IsEmpty () const
bool | IsPresent (int node) const
void | Clear ()

## Public Attributes
friend | EdgeIterator
friend | ConstEdgeIterator
friend | NodeIterator
friend | ConstNodeIterator

## Detailed Description

### template<class NODE_TYPE, class EDGE_TYPE>
class OdinAI::SparseGraph< NODE_TYPE, EDGE_TYPE >

Sparse graph groups together nodes and edges. Implementation is based on the book: Programming Game AI by Example.

## Member Function Documentation

template<class NODE_TYPE , class EDGE_TYPE >

void OdinAI::SparseGraph< NODE_TYPE, EDGE_TYPE >::AddEdge | ( | const EdgeType & | edge | ) |

Add edge to graph.

template<class NODE_TYPE , class EDGE_TYPE >

int OdinAI::SparseGraph< NODE_TYPE, EDGE_TYPE >::AddNode | ( | const NodeType & | node | ) |

Adds a node to the graph, and returns the index.

template<class NODE_TYPE , class EDGE_TYPE >

void OdinAI::SparseGraph< NODE_TYPE, EDGE_TYPE >::Clear | ( |  | ) |

Clear the whole graph.

template<class NODE_TYPE , class EDGE_TYPE >

const EDGE_TYPE & OdinAI::SparseGraph< NODE_TYPE, EDGE_TYPE >::GetEdge | ( | int | from,
|  | int | to
| ) |  | const

Returns the edge with the specific from and to parameter. Constant version.

template<class NODE_TYPE , class EDGE_TYPE >

EDGE_TYPE & OdinAI::SparseGraph< NODE_TYPE, EDGE_TYPE >::GetEdge | ( | int | from,
|  | int | to
| ) |  |

Returns the edge with the specific from and to parameter. Non-const version.

template<class NODE_TYPE , class EDGE_TYPE >

const NODE_TYPE & OdinAI::SparseGraph< NODE_TYPE, EDGE_TYPE >::GetNode | ( | int | index | ) | const

Returns the node by the index. Constant version.

template<class NODE_TYPE , class EDGE_TYPE >

NODE_TYPE & OdinAI::SparseGraph< NODE_TYPE, EDGE_TYPE >::GetNode | ( | int | index | ) |

Returns the node by the index. Non-const version.

template<class NODE_TYPE, class EDGE_TYPE>

bool OdinAI::SparseGraph< NODE_TYPE, EDGE_TYPE >::IsDigraph | ( |  | ) | const
| inline

Returns true if this graph is directed.

template<class NODE_TYPE, class EDGE_TYPE>

bool OdinAI::SparseGraph< NODE_TYPE, EDGE_TYPE >::IsEmpty | ( |  | ) | const
| inline

Returns true if this graph does not contain any nodes.

template<class NODE_TYPE , class EDGE_TYPE >

bool OdinAI::SparseGraph< NODE_TYPE, EDGE_TYPE >::IsPresent | ( | int | node | ) | const

Returns true if the node exist in graph.

template<class NODE_TYPE , class EDGE_TYPE >

int OdinAI::SparseGraph< NODE_TYPE, EDGE_TYPE >::NumActiveNodes | ( |  | ) | const

Returns the number of active nodes.

template<class NODE_TYPE , class EDGE_TYPE >

int OdinAI::SparseGraph< NODE_TYPE, EDGE_TYPE >::NumEdges | ( |  | ) | const

Returns the number of edges.

template<class NODE_TYPE , class EDGE_TYPE >

int OdinAI::SparseGraph< NODE_TYPE, EDGE_TYPE >::NumNodes | ( |  | ) | const

Returns the number of nodes.

template<class NODE_TYPE , class EDGE_TYPE >

void OdinAI::SparseGraph< NODE_TYPE, EDGE_TYPE >::RemoveEdge | ( | int | from,
|  | int | to
| ) |  |

Remove edge from graph.

template<class NODE_TYPE , class EDGE_TYPE >

void OdinAI::SparseGraph< NODE_TYPE, EDGE_TYPE >::RemoveNode | ( | int | node | ) |

Remove node from graph.

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

- E:/Development/Projects/OdinAI/Include/OdinAI/SparseGraph.h