More implementation for attacking
This commit is contained in:
18
graph.cpp
18
graph.cpp
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user