X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FGraph.h;h=50d8bf855da73919e7ac67a5f3bdfc77f6ad2ee3;hb=190ab4774db9d24dcebb29274c019e06f5c1a61c;hp=de1a555117bb4f46a6822eaaa38696e50bf38b02;hpb=06f26e85df99b56fee97282b9f9ac7d51fb976cc;p=lyx.git diff --git a/src/Graph.h b/src/Graph.h index de1a555117..50d8bf855d 100644 --- a/src/Graph.h +++ b/src/Graph.h @@ -13,10 +13,10 @@ #ifndef GRAPH_H #define GRAPH_H -#include "support/mutex.h" #include #include +#include #include @@ -31,10 +31,10 @@ public: /// typedef std::vector EdgePath; /// \return a vector of the vertices from which "to" can be reached - std::vector const getReachableTo(int to, bool clear_visited); - /// \return a vector of the vertices that can be reached from "from" - std::vector const - getReachable(int from, bool only_viewable, bool clear_visited); + EdgePath const getReachableTo(int to, bool clear_visited); + /// \return a vector of the reachable vertices, avoiding all "excludes" + EdgePath const getReachable(int from, bool only_viewable, + bool clear_visited, std::set excludes = std::set()); /// can "from" be reached from "to"? bool isReachable(int from, int to); /// find a path from "from" to "to". always returns one of the @@ -47,12 +47,7 @@ public: private: /// - bool bfs_init(int, bool clear_visited = true); - /// clears the paths from a previous search. should be - /// called before each new one. - void clearPaths(); - /// used to recover a marked path - void getMarkedPath(int from, int to, EdgePath & path); + bool bfs_init(int, bool clear_visited, std::queue & Q); /// these represent the arrows connecting the nodes of the graph. /// this is the basic representation of the graph: as a bunch of /// arrows. @@ -83,8 +78,6 @@ private: std::vector out_arrows; /// used in the search routines bool visited; - /// - EdgePath path; }; /// a container for the vertices /// the index into the vector functions as the identifier by which @@ -94,17 +87,13 @@ private: /// of Format, this is easy, since the Format objects already have ints /// as identifiers.) std::vector vertices_; - /// - std::queue Q_; + /// a counter that we use to assign id's to the arrows /// FIXME This technique assumes a correspondence between the /// ids of the arrows and ids associated with Converters that /// seems kind of fragile. Perhaps a better solution would be /// to pass the ids as we create the arrows. int numedges_; - - /// make public functions thread save - Mutex mutex_; };