- ///
- static std::vector<Vertex> vertices_;
- /// used to keep track of which vertices we have seen
- std::vector<bool> visited_;
- ///
- std::queue<int> Q_;
+ /// a container for the arrows
+ /// we use a list because we want pointers to the arrows,
+ /// and a vector might invalidate them
+ typedef std::list<Arrow> Arrows;
+ Arrows arrows_;
+ /// Represents a vertex of the graph. Note that we could recover
+ /// the in_arrows and out_arrows from the Arrows, so these are in
+ /// effect a kind of cache.
+ struct Vertex {
+ /// arrows that point at this one
+ std::vector<Arrow *> in_arrows;
+ /// arrows out from here
+ std::vector<Arrow *> out_arrows;
+ /// used in the search routines
+ bool visited;
+ };
+ /// a container for the vertices
+ /// the index into the vector functions as the identifier by which
+ /// these are referenced in the Arrow struct
+ /// the code making use of the Graph must keep track of the relation
+ /// between these indices and the objects they represent. (in the case
+ /// of Format, this is easy, since the Format objects already have ints
+ /// as identifiers.)
+ std::vector<Vertex> vertices_;