I am currently working on writing a C++ app whose purpose it is to essentially "demo" various graph algorithms. At the moment, I have a very bare-bones
Graph class working (which utilizes
Edge classes) using edge-list representation (graph object has a list of vertex references where each vertex reference stores a list to incident edges), so I would like to begin adding tons of different algorithms to it.
The "problem" that I am seeing right now, is that these algorithms (at least the ones that I have learned) use various flags, or just additional fields for vertex and edge objects that you would not naturally put into a simple graph class. For example, for breadth-first search, the vertex object has
predecessor fields that I really don't want to add to my basic class. It just seems far too inelegant.
I would like to hear your advice on what would be the most elegant way of using OOP and just C++ in general to tack on a variety of different algorithms to my graph. I would also appreciate any resources which would help me.
One idea that I had was making subclasses of my
Edge classes, for example