All pastes #951810 Raw Edit

Anonymous

public text v1 · immutable
#951810 ·published 2008-03-21 17:57 UTC
rendered paste body
in the class:

		bool hasVertex(const Vertex& v) const ;
		bool hasVertex(const std::string& vName) const;

in the Implementation:

bool Graph::hasVertex(const Vertex& v) const
{
	std::vector<Vertex>::iterator pos;
	for ( pos = vertexes.begin(); pos != vertexes.end(); pos++){
		if (*pos == v);
			return true;
	}
	return false;
}

bool Graph::hasVertex(const std::string& vName) const
{
	std::vector<Vertex>::iterator pos;
	for ( pos = vertexes.begin(); pos != vertexes.end(); pos++){

		if ((*pos).getName() == vName){
			return true;
		}
	}
	return false;
}