Class Graph

Index Home MAE > MAE Architecture > MAE Data Types > Class Index > Class Graph

Using Graph
Public Methods
Graph(graph)
inline void clear()
int addNode(nodelabel, nodedata)
int addNode(nodelabel, nodedata)
bool addEdge(nodelabel1, nodelabel2, bidirectional)
bool addEdge(n1, n2, bidirectional)
inline bool nodeExists(nodelabel)
int findNode(nodelabel) const
bool isVisited(nodelabel) const
inline bool isVisited(nodeid) const
void setVisited(nodelabel, visited)
inline void clearVisited(nodelabel)
void clearAllVisited()
bool isAdjacent(nodelabel1, nodelabel2) const
inline bool edgeExists(nodelabel1, nodelabel2) const
inline const string& getData(nodelabel) const
inline long getDataInt(nodelabel) const
const string& getData(nodeid) const
long getDataInt(nodeid) const
const string& setData(nodelabel, data)
long setData(nodelabel, data)
IntList findCircuit(startNode, shortest)
IntList findCircuit(startNode, shortest)
inline IntList findShortestCircuit(startNode)
inline IntList findShortestCircuit(startNode)
inline IntList findLongestCircuit(startNode)
inline IntList findLongestCircuit(startNode)
inline const GraphNode& operator[](nodelabel) const
inline const GraphNode& operator[](nodeid) const
inline unsigned long size()
inline const string& getLabel(nodeid) const
inline const int getEdgeCount(nodeid) const
string toString() const
unsigned long fromString(graph)
string pathToString(path, includeData) const
Private Properties
Private Methods
IntList findCircuitPath(nodeid, prepath, shortest)

#include <Graph.h >

Using Graph

This is a simple graph class for general application.

Each node has a label, adjacency list, visited flag, and app-specific data.

Public Methods

Graph(graph)

const string& graph

Default value: ""


inline void clear()

int addNode(nodelabel, nodedata)

const string& nodelabel

const string& nodedata

Default value: ""


int addNode(nodelabel, nodedata)

const string& nodelabel

long nodedata


bool addEdge(nodelabel1, nodelabel2, bidirectional)

const string& nodelabel1

const string& nodelabel2

bool bidirectional

Default value: true


bool addEdge(n1, n2, bidirectional)

int n1

int n2

bool bidirectional

Default value: true


inline bool nodeExists(nodelabel)

const string& nodelabel


int findNode(nodelabel) const

const string& nodelabel


bool isVisited(nodelabel) const

const string& nodelabel


inline bool isVisited(nodeid) const

int nodeid


void setVisited(nodelabel, visited)

const string& nodelabel

bool visited

Default value: true


inline void clearVisited(nodelabel)

const string& nodelabel


void clearAllVisited()

bool isAdjacent(nodelabel1, nodelabel2) const

const string& nodelabel1

const string& nodelabel2


inline bool edgeExists(nodelabel1, nodelabel2) const

const string& nodelabel1

const string& nodelabel2


inline const string& getData(nodelabel) const

const string& nodelabel


inline long getDataInt(nodelabel) const

const string& nodelabel


const string& getData(nodeid) const

int nodeid


long getDataInt(nodeid) const

int nodeid


const string& setData(nodelabel, data)

const string& nodelabel

const string& data


long setData(nodelabel, data)

const string& nodelabel

long data


IntList findCircuit(startNode, shortest)

const string& startNode

bool shortest

Default value: true


IntList findCircuit(startNode, shortest)

int startNode

bool shortest

Default value: true


inline IntList findShortestCircuit(startNode)

const string& startNode


inline IntList findShortestCircuit(startNode)

int startNode


inline IntList findLongestCircuit(startNode)

const string& startNode


inline IntList findLongestCircuit(startNode)

int startNode


inline const GraphNode& operator[](nodelabel) const

const string& nodelabel


inline const GraphNode& operator[](nodeid) const

int nodeid


inline unsigned long size()

inline const string& getLabel(nodeid) const

int nodeid


inline const int getEdgeCount(nodeid) const

int nodeid


string toString() const

unsigned long fromString(graph)

const string& graph

Default value: ""


string pathToString(path, includeData) const

const IntList& path

bool includeData

Default value: false


Private Properties

vector <GraphNode > node


Private Methods

IntList findCircuitPath(nodeid, prepath, shortest)

int nodeid

const IntList& prepath

bool shortest