Boost logo

Boost Users :

Subject: Re: [Boost-users] [BGL] visitors.hpp:138: error: no type named 'event_filter' in 'class dijkstra_custom_visitor'
From: The Maschine (justthemaschine_at_[hidden])
Date: 2013-11-22 04:43:31


Hi,

My code is very simple so I suspect I missing something about the real
'examine_vertex' meaning.

One example with the custom visitor and one without that produces the
correct results out site the 'search' (I;d like to be able to do it with a
visitor though for later steps) Simplified to just the essentials.

#### With VISITOR ####

            IndexMap indexMap = boost::get(boost::vertex_index, m_ugraph);
            PredecessorMap predecessorMap(&predecessors[0], indexMap);
            DistanceMap distanceMap(&distances[0], indexMap);

            glm::dvec3 s_mid = m_ugraph[*vertex_iterator_begin].m_mid_point;
            double thres = 500.0f;
            dijkstra_threshold vis(s_mid,thres);

            try {
                boost::dijkstra_shortest_paths(m_ugraph,
*vertex_iterator_begin,
boost::predecessor_map(predecessorMap).distance_map(distanceMap).visitor(vis));
            } catch (...) { }

            int total_node_count2 = 0;
            double total_depth2 = 0.0;
            for (boost::tie(vi, vi_end) = boost::vertices(m_ugraph); vi !=
vi_end; ++vi) {

                if( (double(distances[*vi])*1.1) >=
std::numeric_limits<double>::max() || (std::isnan(distances[*vi])) ||
!(std::isfinite(distances[*vi])) ) {

                } else {
                        total_depth2 += double(distances[*vi]);
                        total_node_count2 += 1;
                }
            }

####
To the total distances and the number of nodes within the radius is not
correct…

#### Without a visitor outside dijkstra_shortest_paths ####

           try {
                boost::dijkstra_shortest_paths(m_ugraph,
*vertex_iterator_begin,
boost::predecessor_map(predecessorMap).distance_map(distanceMap));
            } catch (...) { }

            int total_node_count2 = 0;
            double total_depth2 = 0.0;
            for (boost::tie(vi, vi_end) = boost::vertices(m_ugraph); vi !=
vi_end; ++vi) {

                if( (double(distances[*vi])*1.1) >=
std::numeric_limits<double>::max() || (std::isnan(distances[*vi])) ||
!(std::isfinite(distances[*vi])) ) {
                } else {
                    if( thres > 0.0f && glm::distance(s_mid,
m_ugraph[*vi].m_mid_point) < thres ) {
                        total_depth2 += double(distances[*vi]);
                        total_node_count2 += 1;
                }
            }

###
This give you the correct results but you searched the full graph.

Any ideas?
Thanks



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net