Hello everyone,
I can't quite wrap my head around this problem so I need a little help please.
Give a map represented by a std::vector<int> map that might look like this...
0 0 0 0 1 0
0 0 0 0 1 0
1 0 1 1 1 0
0 0 0 0 1 0
where '1' is an obstacle and '0' is a free moving space, and where the distances between the
values are arbitrary.
I would like the following,
one std::vector<Node> nodes;
two std::vector<Edge> edges;
I know potentially, that every 'node' in my graph (that being a 0) can have 8 possible edges.
What I don't know however, is how to iterate over my graph, and keep track of which edges have been already created.
For example, map[0] will have 3 edges to each of its neighbours. Now, when I move to map[1], and create the edges to its neighbours, how do I check, or keep track of, whether map[0] already has an edge to map[1].
Thanks,
Mike