Original Post
ok I've been reading Data Structures for Game Programmers. Now I've gotten to the chapter about Graphs. I disagree with the way he created the Arc and Node classes. They are too dependent on each other. One can't exist without the other. If the author in here, please feel free to make comments. Doing some thinking about it, I've come up with this:
template <typename Data>
class Node {
Data x, y; //coordinates of the Node
bool visited;
};
template <typename Data>
class Arc {
Node<Data>* node1;
Node<Data>* node2; //will hold the actual address of the nodes, for traversal
Data cost; //I want Data to be either an int or float only... gotta look that up
};
That is what I have so far. The rest of my code is at home. But is this a bad start? What disadvantages would this have over what the author presented (Again, I know it would useful if I posted the code, but I don't have it with me)?