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. // Copyright 2004, 2005 Trustees of Indiana University // Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek, // Doug Gregor, D. Kevin McGrath // // 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_CUTHILL_MCKEE_HPP #define BOOST_GRAPH_CUTHILL_MCKEE_HPP #include
#include
#include
/* (Reverse) Cuthill-McKee Algorithm for matrix reordering */ namespace boost { namespace detail { template < typename OutputIterator, typename Buffer, typename DegreeMap > class bfs_rcm_visitor:public default_bfs_visitor { public: bfs_rcm_visitor(OutputIterator *iter, Buffer *b, DegreeMap deg): permutation(iter), Qptr(b), degree(deg) { } template
void examine_vertex(Vertex u, Graph&) { *(*permutation)++ = u; index_begin = Qptr->size(); } template
void finish_vertex(Vertex, Graph&) { using std::sort; typedef typename property_traits
::value_type ds_type; typedef indirect_cmp
> Compare; Compare comp(degree); sort(Qptr->begin()+index_begin, Qptr->end(), comp); } protected: OutputIterator *permutation; int index_begin; Buffer *Qptr; DegreeMap degree; }; } // namespace detail // Reverse Cuthill-McKee algorithm with a given starting Vertex. // // If user provides a reverse iterator, this will be a reverse-cuthill-mckee // algorithm, otherwise it will be a standard CM algorithm template
OutputIterator cuthill_mckee_ordering(const Graph& g, std::deque< typename graph_traits
::vertex_descriptor > vertex_queue, OutputIterator permutation, ColorMap color, DegreeMap degree) { //create queue, visitor...don't forget namespaces! typedef typename property_traits
::value_type ds_type; typedef typename graph_traits
::vertex_descriptor Vertex; typedef typename boost::sparse::sparse_ordering_queue
queue; typedef typename detail::bfs_rcm_visitor
Visitor; typedef typename property_traits
::value_type ColorValue; typedef color_traits
Color; queue Q; //create a bfs_rcm_visitor as defined above Visitor vis(&permutation, &Q, degree); typename graph_traits
::vertex_iterator ui, ui_end; // Copy degree to pseudo_degree // initialize the color map for (tie(ui, ui_end) = vertices(g); ui != ui_end; ++ui){ put(color, *ui, Color::white()); } while( !vertex_queue.empty() ) { Vertex s = vertex_queue.front(); vertex_queue.pop_front(); //call BFS with visitor breadth_first_visit(g, s, Q, vis, color); } return permutation; } // This is the case where only a single starting vertex is supplied. template
OutputIterator cuthill_mckee_ordering(const Graph& g, typename graph_traits
::vertex_descriptor s, OutputIterator permutation, ColorMap color, DegreeMap degree) { std::deque< typename graph_traits
::vertex_descriptor > vertex_queue; vertex_queue.push_front( s ); return cuthill_mckee_ordering(g, vertex_queue, permutation, color, degree); } // This is the version of CM which selects its own starting vertex template < class Graph, class OutputIterator, class ColorMap, class DegreeMap> OutputIterator cuthill_mckee_ordering(const Graph& G, OutputIterator permutation, ColorMap color, DegreeMap degree) { if (vertices(G).first == vertices(G).second) return permutation; typedef typename boost::graph_traits
::vertex_descriptor Vertex; typedef typename boost::graph_traits
::vertex_iterator VerIter; typedef typename property_traits
::value_type ColorValue; typedef color_traits
Color; std::deque
vertex_queue; // Mark everything white BGL_FORALL_VERTICES_T(v, G, Graph) put(color, v, Color::white()); // Find one vertex from each connected component BGL_FORALL_VERTICES_T(v, G, Graph) { if (get(color, v) == Color::white()) { depth_first_visit(G, v, dfs_visitor<>(), color); vertex_queue.push_back(v); } } // Find starting nodes for all vertices // TBD: How to do this with a directed graph? for (typename std::deque
::iterator i = vertex_queue.begin(); i != vertex_queue.end(); ++i) *i = find_starting_node(G, *i, color, degree); return cuthill_mckee_ordering(G, vertex_queue, permutation, color, degree); } template
OutputIterator cuthill_mckee_ordering(const Graph& G, OutputIterator permutation, VertexIndexMap index_map) { if (vertices(G).first == vertices(G).second) return permutation; typedef out_degree_property_map
DegreeMap; std::vector
colors(num_vertices(G)); return cuthill_mckee_ordering(G, permutation, make_iterator_property_map(&colors[0], index_map, colors[0]), make_out_degree_map(G)); } template
inline OutputIterator cuthill_mckee_ordering(const Graph& G, OutputIterator permutation) { return cuthill_mckee_ordering(G, permutation, get(vertex_index, G)); } } // namespace boost #endif // BOOST_GRAPH_CUTHILL_MCKEE_HPP
cuthill_mckee_ordering.hpp
Page URL
File URL
Prev
20/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.