DriveHQ Start Menu
Cloud Drive Mapping
Folder Sync
Cloud Backup
True Drop Box
FTP/SFTP Hosting
Group Account
DriveHQ Start Menu
Online File Server
My Storage
|
Manage Shares
|
Publishes
|
Drop Boxes
|
Group Account
WebDAV Drive Mapping
Cloud Drive Home
|
WebDAV Guide
|
Drive Mapping Tool
|
Drive Mapping URL
Complete Data Backup
Backup Guide
|
Online Backup Tool
|
Cloud-to-Cloud Backup
FTP, Email & Web Service
FTP Home
|
FTP Hosting FAQ
|
Email Hosting
|
EmailManager
|
Web Hosting
Help & Resources
About
|
Enterprise Service
|
Partnership
|
Comparisons
|
Support
Quick Links
Security and Privacy
Download Software
Service Manual
Use Cases
Group Account
Online Help
Blog
Contact
Cloud Surveillance
Sign Up
Login
Features
Business Features
Online File Server
FTP Hosting
Cloud Drive Mapping
Cloud File Backup
Email Backup & Hosting
Cloud File Sharing
Folder Synchronization
Group Management
True Drop Box
Full-text Search
AD Integration/SSO
Mobile Access
IP Camera & DVR Solution
More...
Personal Features
Personal Cloud Drive
Backup All Devices
Mobile APPs
Personal Web Hosting
Sub-Account (for Kids)
Home/PC/Kids Monitoring
More...
Software
DriveHQ Drive Mapping Tool
DriveHQ FileManager
DriveHQ Online Backup
DriveHQ Mobile Apps
Pricing
Business Plans & Pricing
Personal Plans & Pricing
Price Comparison with Others
Feature Comparison with Others
Install Mobile App
Sign up
Creating account...
Invalid character in username! Only 0-9, a-z, A-Z, _, -, . allowed.
Username is required!
Invalid email address!
E-mail is required!
Password is required!
Password is invalid!
Password and confirmation do not match.
Confirm password is required!
I accept
Membership Agreement
Please read the Membership Agreement and check "I accept"!
Free Quick Sign-up
Sign-up Page
Log in
Signing in...
Username or e-mail address is required!
Password is required!
Keep me logged in
Quick Login
Forgot Password
Up
Upload
Download
Share
Publish
New Folder
New File
Copy
Cut
Delete
Paste
Rate
Upgrade
Rotate
Effect
Edit
Slide
History
//======================================================================= // Copyright 1997, 1998, 1999, 2000 University of Notre Dame. // Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) //======================================================================= #ifndef BOOST_GRAPH_DIJKSTRA_HPP #define BOOST_GRAPH_DIJKSTRA_HPP #include
#include
#include
#include
#include
#include
#include
#include
#ifdef BOOST_GRAPH_DIJKSTRA_TESTING # include
#endif // BOOST_GRAPH_DIJKSTRA_TESTING namespace boost { #ifdef BOOST_GRAPH_DIJKSTRA_TESTING static bool dijkstra_relaxed_heap = true; #endif template
struct DijkstraVisitorConcept { void constraints() { function_requires< CopyConstructibleConcept
>(); vis.initialize_vertex(u, g); vis.discover_vertex(u, g); vis.examine_vertex(u, g); vis.examine_edge(e, g); vis.edge_relaxed(e, g); vis.edge_not_relaxed(e, g); vis.finish_vertex(u, g); } Visitor vis; Graph g; typename graph_traits
::vertex_descriptor u; typename graph_traits
::edge_descriptor e; }; template
class dijkstra_visitor : public bfs_visitor
{ public: dijkstra_visitor() { } dijkstra_visitor(Visitors vis) : bfs_visitor
(vis) { } template
void edge_relaxed(Edge e, Graph& g) { invoke_visitors(this->m_vis, e, g, on_edge_relaxed()); } template
void edge_not_relaxed(Edge e, Graph& g) { invoke_visitors(this->m_vis, e, g, on_edge_not_relaxed()); } private: template
void tree_edge(Edge u, Graph& g) { } }; template
dijkstra_visitor
make_dijkstra_visitor(Visitors vis) { return dijkstra_visitor
(vis); } typedef dijkstra_visitor<> default_dijkstra_visitor; namespace detail { template
struct dijkstra_bfs_visitor { typedef typename property_traits
::value_type D; dijkstra_bfs_visitor(UniformCostVisitor vis, UpdatableQueue& Q, WeightMap w, PredecessorMap p, DistanceMap d, BinaryFunction combine, BinaryPredicate compare, D zero) : m_vis(vis), m_Q(Q), m_weight(w), m_predecessor(p), m_distance(d), m_combine(combine), m_compare(compare), m_zero(zero) { } template
void tree_edge(Edge e, Graph& g) { m_decreased = relax(e, g, m_weight, m_predecessor, m_distance, m_combine, m_compare); if (m_decreased) m_vis.edge_relaxed(e, g); else m_vis.edge_not_relaxed(e, g); } template
void gray_target(Edge e, Graph& g) { m_decreased = relax(e, g, m_weight, m_predecessor, m_distance, m_combine, m_compare); if (m_decreased) { m_Q.update(target(e, g)); m_vis.edge_relaxed(e, g); } else m_vis.edge_not_relaxed(e, g); } template
void initialize_vertex(Vertex u, Graph& g) { } template
void non_tree_edge(Edge, Graph&) { } template
void discover_vertex(Vertex u, Graph& g) { m_vis.discover_vertex(u, g); } template
void examine_vertex(Vertex u, Graph& g) { m_vis.examine_vertex(u, g); } template
void examine_edge(Edge e, Graph& g) { if (m_compare(get(m_weight, e), m_zero)) throw negative_edge(); m_vis.examine_edge(e, g); } template
void black_target(Edge, Graph&) { } template
void finish_vertex(Vertex u, Graph& g) { m_vis.finish_vertex(u, g); } UniformCostVisitor m_vis; UpdatableQueue& m_Q; WeightMap m_weight; PredecessorMap m_predecessor; DistanceMap m_distance; BinaryFunction m_combine; BinaryPredicate m_compare; bool m_decreased; D m_zero; }; } // namespace detail // Call breadth first search with default color map. template
inline void dijkstra_shortest_paths_no_init (const VertexListGraph& g, typename graph_traits
::vertex_descriptor s, PredecessorMap predecessor, DistanceMap distance, WeightMap weight, IndexMap index_map, Compare compare, Combine combine, DistZero zero, DijkstraVisitor vis) { std::vector
color(num_vertices(g)); default_color_type c = white_color; dijkstra_shortest_paths_no_init( g, s, predecessor, distance, weight, index_map, compare, combine, zero, vis, make_iterator_property_map(&color[0], index_map, c)); } // Call breadth first search template
inline void dijkstra_shortest_paths_no_init (const VertexListGraph& g, typename graph_traits
::vertex_descriptor s, PredecessorMap predecessor, DistanceMap distance, WeightMap weight, IndexMap index_map, Compare compare, Combine combine, DistZero zero, DijkstraVisitor vis, ColorMap color) { typedef indirect_cmp
IndirectCmp; IndirectCmp icmp(distance, compare); typedef typename graph_traits
::vertex_descriptor Vertex; #ifdef BOOST_GRAPH_DIJKSTRA_TESTING if (!dijkstra_relaxed_heap) { typedef mutable_queue
, IndirectCmp, IndexMap> MutableQueue; MutableQueue Q(num_vertices(g), icmp, index_map); detail::dijkstra_bfs_visitor
bfs_vis(vis, Q, weight, predecessor, distance, combine, compare, zero); breadth_first_visit(g, s, Q, bfs_vis, color); return; } #endif // BOOST_GRAPH_DIJKSTRA_TESTING typedef relaxed_heap
MutableQueue; MutableQueue Q(num_vertices(g), icmp, index_map); detail::dijkstra_bfs_visitor
bfs_vis(vis, Q, weight, predecessor, distance, combine, compare, zero); breadth_first_visit(g, s, Q, bfs_vis, color); } // Initialize distances and call breadth first search with default color map template
inline void dijkstra_shortest_paths (const VertexListGraph& g, typename graph_traits
::vertex_descriptor s, PredecessorMap predecessor, DistanceMap distance, WeightMap weight, IndexMap index_map, Compare compare, Combine combine, DistInf inf, DistZero zero, DijkstraVisitor vis) { std::vector
color(num_vertices(g)); default_color_type c = white_color; dijkstra_shortest_paths(g, s, predecessor, distance, weight, index_map, compare, combine, inf, zero, vis, make_iterator_property_map(&color[0], index_map, c)); } // Initialize distances and call breadth first search template
inline void dijkstra_shortest_paths (const VertexListGraph& g, typename graph_traits
::vertex_descriptor s, PredecessorMap predecessor, DistanceMap distance, WeightMap weight, IndexMap index_map, Compare compare, Combine combine, DistInf inf, DistZero zero, DijkstraVisitor vis, ColorMap color) { typedef typename property_traits
::value_type ColorValue; typedef color_traits
Color; typename graph_traits
::vertex_iterator ui, ui_end; for (tie(ui, ui_end) = vertices(g); ui != ui_end; ++ui) { vis.initialize_vertex(*ui, g); put(distance, *ui, inf); put(predecessor, *ui, *ui); put(color, *ui, Color::white()); } put(distance, s, zero); dijkstra_shortest_paths_no_init(g, s, predecessor, distance, weight, index_map, compare, combine, zero, vis, color); } namespace detail { // Handle defaults for PredecessorMap and // Distance Compare, Combine, Inf and Zero template
inline void dijkstra_dispatch2 (const VertexListGraph& g, typename graph_traits
::vertex_descriptor s, DistanceMap distance, WeightMap weight, IndexMap index_map, const Params& params, ColorMap color) { // Default for predecessor map dummy_property_map p_map; typedef typename property_traits
::value_type D; dijkstra_shortest_paths (g, s, choose_param(get_param(params, vertex_predecessor), p_map), distance, weight, index_map, choose_param(get_param(params, distance_compare_t()), std::less
()), choose_param(get_param(params, distance_combine_t()), closed_plus
()), choose_param(get_param(params, distance_inf_t()), (std::numeric_limits
::max)()), choose_param(get_param(params, distance_zero_t()), D()), choose_param(get_param(params, graph_visitor), make_dijkstra_visitor(null_visitor())), color); } template
inline void dijkstra_dispatch1 (const VertexListGraph& g, typename graph_traits
::vertex_descriptor s, DistanceMap distance, WeightMap weight, IndexMap index_map, const Params& params, ColorMap color) { // Default for distance map typedef typename property_traits
::value_type D; typename std::vector
::size_type n = is_default_param(distance) ? num_vertices(g) : 1; std::vector
distance_map(n); // Default for color map typename std::vector
::size_type m = is_default_param(color) ? num_vertices(g) : 1; std::vector
color_map(m); detail::dijkstra_dispatch2 (g, s, choose_param(distance, make_iterator_property_map (distance_map.begin(), index_map, distance_map[0])), weight, index_map, params, choose_param(color, make_iterator_property_map (color_map.begin(), index_map, color_map[0]))); } } // namespace detail // Named Parameter Variant template
inline void dijkstra_shortest_paths (const VertexListGraph& g, typename graph_traits
::vertex_descriptor s, const bgl_named_params
& params) { // Default for edge weight and vertex index map is to ask for them // from the graph. Default for the visitor is null_visitor. detail::dijkstra_dispatch1 (g, s, get_param(params, vertex_distance), choose_const_pmap(get_param(params, edge_weight), g, edge_weight), choose_const_pmap(get_param(params, vertex_index), g, vertex_index), params, get_param(params, vertex_color)); } } // namespace boost #endif // BOOST_GRAPH_DIJKSTRA_HPP
dijkstra_shortest_paths.hpp
Page URL
File URL
Prev
23/95
Next
Download
( 13 KB )
Note: The DriveHQ service banners will NOT be displayed if the file owner is a paid member.
Comments
Total ratings:
0
Average rating:
Not Rated
Would you like to comment?
Join DriveHQ
for a free account, or
Logon
if you are already a member.