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_DETAIL_CONNECTED_COMPONENTS_HPP #define BOOST_GRAPH_DETAIL_CONNECTED_COMPONENTS_HPP #if defined(__sgi) && !defined(__GNUC__) #pragma set woff 1234 #endif #include
namespace boost { namespace detail { //========================================================================= // Implementation details of connected_components // This is used both in the connected_components algorithm and in // the kosaraju strong components algorithm during the second DFS // traversal. template
class components_recorder : public DFSVisitor { typedef typename property_traits
::value_type comp_type; public: components_recorder(ComponentsPA c, comp_type& c_count, DFSVisitor v) : DFSVisitor(v), m_component(c), m_count(c_count) {} template
void start_vertex(Vertex u, Graph& g) { ++m_count; DFSVisitor::start_vertex(u, g); } template
void discover_vertex(Vertex u, Graph& g) { put(m_component, u, m_count); DFSVisitor::discover_vertex(u, g); } protected: ComponentsPA m_component; comp_type& m_count; }; template
class time_recorder : public DFSVisitor { public: time_recorder(DiscoverTimeMap d, FinishTimeMap f, TimeT& t, DFSVisitor v) : DFSVisitor(v), m_discover_time(d), m_finish_time(f), m_t(t) {} template
void discover_vertex(Vertex u, Graph& g) { put(m_discover_time, u, ++m_t); DFSVisitor::discover_vertex(u, g); } template
void finish_vertex(Vertex u, Graph& g) { put(m_finish_time, u, ++m_t); DFSVisitor::discover_vertex(u, g); } protected: DiscoverTimeMap m_discover_time; FinishTimeMap m_finish_time; TimeT m_t; }; template
time_recorder
record_times(DiscoverTimeMap d, FinishTimeMap f, TimeT& t, DFSVisitor vis) { return time_recorder
(d, f, t, vis); } //========================================================================= // Implementation detail of dynamic_components //------------------------------------------------------------------------- // Helper functions for the component_index class // Record the representative vertices in the header array. // Representative vertices now point to the component number. template
inline void build_components_header(Parent p, OutputIterator header, Integer num_nodes) { Parent component = p; Integer component_num = 0; for (Integer v = 0; v != num_nodes; ++v) if (p[v] == v) { *header++ = v; component[v] = component_num++; } } // Pushes x onto the front of the list. The list is represented in // an array. template
inline void push_front(Next next, T& head, V x) { T tmp = head; head = x; next[x] = tmp; } // Create a linked list of the vertices in each component // by reusing the representative array. template
void link_components(Parent1 component, Parent2 header, Integer num_nodes, Integer num_components) { // Make the non-representative vertices point to their component Parent1 representative = component; for (Integer v = 0; v != num_nodes; ++v) if (component[v] >= num_components || header[component[v]] != v) component[v] = component[representative[v]]; // initialize the "head" of the lists to "NULL" std::fill_n(header, num_components, num_nodes); // Add each vertex to the linked list for its component Parent1 next = component; for (Integer k = 0; k != num_nodes; ++k) push_front(next, header[component[k]], k); } template
void construct_component_index(IndexContainer& index, HeaderContainer& header) { build_components_header(index.begin(), std::back_inserter(header), index.end() - index.begin()); link_components(index.begin(), header.begin(), index.end() - index.begin(), header.end() - header.begin()); } template
class component_iterator : boost::forward_iterator_helper< component_iterator
, Integer, Distance,Integer*, Integer&> { public: typedef component_iterator self; IndexIterator next; Integer node; typedef std::forward_iterator_tag iterator_category; typedef Integer value_type; typedef Integer& reference; typedef Integer* pointer; typedef Distance difference_type; component_iterator() {} component_iterator(IndexIterator x, Integer i) : next(x), node(i) {} Integer operator*() const { return node; } self& operator++() { node = next[node]; return *this; } }; template
inline bool operator==(const component_iterator
& x, const component_iterator
& y) { return x.node == y.node; } } // namespace detail } // namespace detail #if defined(__sgi) && !defined(__GNUC__) #pragma reset woff 1234 #endif #endif
connected_components.hpp
Page URL
File URL
Prev
4/16
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.