DriveHQ Start Menu
Cloud Drive Mapping
Folder Sync
True Drop Box
FTP/SFTP Hosting
Group Account
Team Anywhere
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
|
Cloud-to-Cloud Backup
|
DVR/Camera Backup
FTP, Email & Web Service
FTP/SFTP Hosting
|
Email Hosting
|
Web Hosting
|
Webcam Hosting
Other Products & Services
Team Anywhere
|
Connect to Remote PC
|
Cloud Surveillance
|
Virtual CCTV NVR
Quick Links
Security and Privacy
Customer Support
Service Manual
Use Cases
Group Account
Online Help
Support Forum
Contact Us
About DriveHQ
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
Personal Features
Personal Cloud Drive
Backup All Devices
Mobile APPs
Personal Web Hosting
Sub-Account (for Kids)
Home/PC/Kids Monitoring
Other Features
Team Anywhere (Remote Desktop Service)
CameraFTP Cloud Surveillance
Software
DriveHQ Drive Mapping Tool
DriveHQ FileManager
DriveHQ Online Backup
DriveHQ Team Anywhere for Windows (Beta)
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 2002 Indiana University. // 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_DAG_SHORTEST_PATHS_HPP #define BOOST_GRAPH_DAG_SHORTEST_PATHS_HPP #include
#include
// single-source shortest paths for a Directed Acyclic Graph (DAG) namespace boost { // Initalize distances and call depth first search template
inline void dag_shortest_paths (const VertexListGraph& g, typename graph_traits
::vertex_descriptor s, DistanceMap distance, WeightMap weight, ColorMap color, PredecessorMap pred, DijkstraVisitor vis, Compare compare, Combine combine, DistInf inf, DistZero zero) { typedef typename graph_traits
::vertex_descriptor Vertex; std::vector
rev_topo_order; rev_topo_order.reserve(num_vertices(g)); // Call 'depth_first_visit', not 'topological_sort', because we don't // want to traverse the entire graph, only vertices reachable from 's', // and 'topological_sort' will traverse everything. The logic below // is the same as for 'topological_sort', only we call 'depth_first_visit' // and 'topological_sort' calls 'depth_first_search'. topo_sort_visitor
> > topo_visitor(std::back_inserter(rev_topo_order)); depth_first_visit(g, s, topo_visitor, color); typename graph_traits
::vertex_iterator ui, ui_end; for (tie(ui, ui_end) = vertices(g); ui != ui_end; ++ui) { put(distance, *ui, inf); put(pred, *ui, *ui); } put(distance, s, zero); vis.discover_vertex(s, g); typename std::vector
::reverse_iterator i; for (i = rev_topo_order.rbegin(); i != rev_topo_order.rend(); ++i) { Vertex u = *i; vis.examine_vertex(u, g); typename graph_traits
::out_edge_iterator e, e_end; for (tie(e, e_end) = out_edges(u, g); e != e_end; ++e) { vis.discover_vertex(target(*e, g), g); bool decreased = relax(*e, g, weight, pred, distance, combine, compare); if (decreased) vis.edge_relaxed(*e, g); else vis.edge_not_relaxed(*e, g); } vis.finish_vertex(u, g); } } namespace detail { // Defaults are the same as Dijkstra's algorithm // Handle Distance Compare, Combine, Inf and Zero defaults template
inline void dag_sp_dispatch2 (const VertexListGraph& g, typename graph_traits
::vertex_descriptor s, DistanceMap distance, WeightMap weight, ColorMap color, IndexMap id, DijkstraVisitor vis, const Params& params) { typedef typename property_traits
::value_type D; dummy_property_map p_map; dag_shortest_paths (g, s, distance, weight, color, choose_param(get_param(params, vertex_predecessor), p_map), vis, 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())); } // Handle DistanceMap and ColorMap defaults template
inline void dag_sp_dispatch1 (const VertexListGraph& g, typename graph_traits
::vertex_descriptor s, DistanceMap distance, WeightMap weight, ColorMap color, IndexMap id, DijkstraVisitor vis, const Params& params) { typedef typename property_traits
::value_type T; typename std::vector
::size_type n; n = is_default_param(distance) ? num_vertices(g) : 1; std::vector
distance_map(n); n = is_default_param(color) ? num_vertices(g) : 1; std::vector
color_map(n); dag_sp_dispatch2 (g, s, choose_param(distance, make_iterator_property_map(distance_map.begin(), id, distance_map[0])), weight, choose_param(color, make_iterator_property_map(color_map.begin(), id, color_map[0])), id, vis, params); } } // namespace detail template
inline void dag_shortest_paths (const VertexListGraph& g, typename graph_traits
::vertex_descriptor s, const bgl_named_params
& params) { // assert that the graph is directed... null_visitor null_vis; detail::dag_sp_dispatch1 (g, s, get_param(params, vertex_distance), choose_const_pmap(get_param(params, edge_weight), g, edge_weight), get_param(params, vertex_color), choose_const_pmap(get_param(params, vertex_index), g, vertex_index), choose_param(get_param(params, graph_visitor), make_dijkstra_visitor(null_vis)), params); } } // namespace boost #endif // BOOST_GRAPH_DAG_SHORTEST_PATHS_HPP
dag_shortest_paths.hpp
Page URL
File URL
Prev
21/95
Next
Download
( 6 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.