Boost Graph Problem



  • Hallo

    Ich versuche einen Graphen aus der Boost-Bibliothek zu erzeugen.
    Dabei geh ich wie folgt vor:

    #include <boost/graph/adjacency_list.hpp>
    #include <boost/graph/breadth_first_search.hpp>
    
    class Tile;
    
    typedef boost::adjacency_list<boost::setS, boost::slistS, boost::undirectedS, Tile*> Graph;
    typedef boost::graph_traits<Graph>::vertex_descriptor GraphVertex;
    
    G g;
    
    class Visitor : public boost::default_bfs_visitor
    {
    
        public:
    
            Visitor (const Tile* const pTile, bool& bSuccess)
            : m_pTile (pTile), m_bSuccess (bSuccess) { }
    
            void discover_vertex (GraphVertex v, Graph& g)
            {
                /*if (g [v] == m_pTile)
                {
                    m_bSuccess = true;
                }*/
            }
    
        private:
    
            const Tile* const m_pTile;
            bool& m_bSuccess;
    
    };
    
    bool pathExists (Graph& g, Tile* pTile1, Tile* pTile2)
    {
        bool bSuccess = false;
        Visitor v (pTile2, bSuccess);
        GraphVertex s = g [pTile1];
        boost::breadth_first_search (g, s, boost::visitor (v)); // diese Zeile verursacht den Fehler
        return bSuccess;
    }
    
    bool put (Tile& tile1, Tile& tile2)
    {
        if (! pathExists (m_pImplData -> g, &tile1, &tile2))
        {
            boost::add_edge (&tile1, &tile2, m_pImplData -> g);
            return true;
        }
        return false;
    }
    

    Beim Kompilieren erhalten ich eine Orgie von Fehlermeldungen, mit der ich Nichts anzufangen weiß, aus der aber diese Zeilen für mich hervorstechen:

    /usr/include/boost/graph/two_bit_color_map.hpp:65: error: invalid cast from type ‘boost::detail::error_property_not_found’ to type ‘size_t’
    /usr/include/boost/graph/two_bit_color_map.hpp:66: error: no match for ‘operator%’ in ‘i % 4’
    /usr/include/boost/graph/two_bit_color_map.hpp:66: error: no match for ‘operator/’ in ‘i / 4’

    Kann jemand helfen?

    Danke im Voraus

    PS. Meine Absicht ist es, einen zyklenfreien Graphen zu implementieren. Geht das vielleicht auch einfacher?


Anmelden zum Antworten