More implementation for attacking

This commit is contained in:
2011-06-24 12:18:52 -04:00
parent 931ced321a
commit e51a328641
4 changed files with 44 additions and 20 deletions

View File

@ -138,7 +138,7 @@ list<Vertex*> Graph::get_colour(int colour)
}
list<Edge> Graph::get_vertex_edges(Vertex* v)
list<Edge> Graph::get_edges(Vertex* v)
{
list<Edge> answer;
@ -151,3 +151,19 @@ list<Edge> Graph::get_vertex_edges(Vertex* v)
return answer;
}
list<Vertex*> Graph::get_neighbors(Vertex* v)
{
list<Vertex*> answer;
for (list<Edge>::iterator cursor = edges.begin();
cursor != edges.end(); cursor++)
{
Edge e = *cursor;
if (e.a == v) answer.push_back(e.b);
else if (e.b == v) answer.push_back(e.a);
}
return answer;
}