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 2001 Universite Joseph Fourier, Grenoble. // Author: Fran�ois Faure // // 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_ADJACENCY_LIST_IO_HPP #define BOOST_GRAPH_ADJACENCY_LIST_IO_HPP #include
#include
#include
#include
// Method read to parse an adjacency list from an input stream. Examples: // cin >> read( G ); // cin >> read( G, NodePropertySubset(), EdgepropertySubset() ); // // Method write to print an adjacency list to an output stream. Examples: // cout << write( G ); // cout << write( G, NodePropertySubset(), EdgepropertySubset() ); namespace boost { /* outline - basic property input - get property subset - graph parser - property printer - graph printer - user methods */ //=========================================================================== // basic property input template
std::istream& operator >> ( std::istream& in, property
& p ) { in >> p.m_value >> *(static_cast
(&p)); // houpla !! return in; } template
std::istream& operator >> ( std::istream& in, property
& p ) { in >> p.m_value; return in; } inline std::istream& operator >> ( std::istream& in, no_property& ) { return in; } // basic property input //=========================================================================== // get property subsets // get a single property tagged Stag template
void get ( property
& p, const V& v, Stag s ) { get( *(static_cast
(&p)),v,s ); } template
void get ( property
& p, const V& v, Stag ) { p.m_value = v; } // get a subset of properties tagged Stag template
void getSubset ( property
& p, const property
& s ) { get( p, s.m_value, Stag() ); getSubset( p, Snext(s) ); } template
void getSubset ( property
& p, const property
& s) { get( p, s.m_value, Stag() ); } inline void getSubset ( no_property& p, const no_property& s ) { } #if !defined(BOOST_GRAPH_NO_BUNDLED_PROPERTIES) template
void getSubset(T& p, const U& s) { p = s; } template
void getSubset(T&, const no_property&) { } #endif // get property subset //=========================================================================== // graph parser typedef enum{ PARSE_NUM_NODES, PARSE_VERTEX, PARSE_EDGE } GraphParserState; template
struct GraphParser { typedef Graph_t Graph; GraphParser( Graph* g ): graph(g) {} GraphParser& operator () ( std::istream& in ) { typedef typename graph_traits
::vertex_descriptor Vertex; std::vector
nodes; GraphParserState state = PARSE_VERTEX; unsigned int numLine = 1; char c; while ( in.get(c) ) { if( c== '#' ) skip(in); else if( c== 'n' ) state = PARSE_NUM_NODES; else if( c== 'v' ) state = PARSE_VERTEX; else if( c== 'e' ) state = PARSE_EDGE; else if( c== '\n' ) numLine++; else if( !std::isspace(c) ){ in.putback(c); if( state == PARSE_VERTEX ){ VertexPropertySubset readProp; if( in >> readProp ) { VertexProperty vp; getSubset( vp, readProp ); nodes.push_back( add_vertex(vp, *graph) ); } else std::cerr<<"read vertex, parse error at line"<
> source >> target; if( in >> readProp ) { EdgeProperty ep; getSubset( ep, readProp ); add_edge(nodes[source], nodes[target], ep, *graph); } else std::cerr<<"read edge, parse error at line"<
> n ){ for( int i=0; i
struct PropertyPrinter { typedef typename Property::value_type Value; typedef typename Property::tag_type Tag; typedef typename Property::next_type Next; PropertyPrinter( const Graph& g ):graph(&g){} template
PropertyPrinter& operator () ( std::ostream& out, Iterator it ) { typename property_map
::type ps = get(Tag(), *graph); out << ps[ *it ] <<" "; PropertyPrinter
print(*graph); print(out, it); return (*this); } private: const Graph* graph; }; #else template
struct PropertyPrinter { PropertyPrinter( const Graph& g ):graph(&g){} template
PropertyPrinter& operator () ( std::ostream& out, Iterator it ) { out << (*graph)[ *it ] <<" "; return (*this); } private: const Graph* graph; }; template
struct PropertyPrinter
> { PropertyPrinter( const Graph& g ):graph(&g){} template
PropertyPrinter& operator () ( std::ostream& out, Iterator it ) { typename property_map
::type ps = get(Tag(), *graph); out << ps[ *it ] <<" "; PropertyPrinter
print(*graph); print(out, it); return (*this); } private: const Graph* graph; }; #endif template
struct PropertyPrinter
{ PropertyPrinter( const Graph& ){} template
PropertyPrinter& operator () ( std::ostream&, Iterator it ){ return *this; } }; // property printer //========================================================================= // graph printer template
struct EdgePrinter { typedef Graph_t Graph; typedef typename graph_traits
::vertex_descriptor Vertex; EdgePrinter( const Graph& g ) : graph(g) {} const EdgePrinter& operator () ( std::ostream& out ) const { // assign indices to vertices std::map
indices; int num = 0; typename graph_traits
::vertex_iterator vi; for (vi = vertices(graph).first; vi != vertices(graph).second; ++vi){ indices[*vi] = num++; } // write edges PropertyPrinter
print_Edge(graph); out << "e" << std::endl; typename graph_traits
::edge_iterator ei; for (ei = edges(graph).first; ei != edges(graph).second; ++ei){ out << indices[source(*ei,graph)] << " " << indices[target(*ei,graph)] << " "; print_Edge(out,ei); out << std::endl; } out << std::endl; return (*this); } protected: const Graph& graph; }; template
struct GraphPrinter: public EdgePrinter
{ GraphPrinter( const Graph& g ) : EdgePrinter
(g) {} const GraphPrinter& operator () ( std::ostream& out ) const { PropertyPrinter
printNode(this->graph); out << "v"<
::vertex_iterator vi; for (vi = vertices(this->graph).first; vi != vertices(this->graph).second; ++vi){ printNode(out,vi); out << std::endl; } EdgePrinter
::operator ()( out ); return (*this); } }; template
struct GraphPrinter
: public EdgePrinter
{ GraphPrinter( const Graph& g ) : EdgePrinter
(g) {} const GraphPrinter& operator () ( std::ostream& out ) const { out << "n "<< num_vertices(this->graph) << std::endl; EdgePrinter
::operator ()( out ); return (*this); } }; // graph printer //========================================================================= // user methods /// input stream for reading a graph template
std::istream& operator >> ( std::istream& in, GraphParser
gp ) { gp(in); return in; } /// graph parser for given subsets of internal vertex and edge properties template
GraphParser
,VP,EP,VPS,EPS> read( adjacency_list
& g, VPS vps, EPS eps ) { return GraphParser
,VP,EP,VPS,EPS>(&g); } /// graph parser for all internal vertex and edge properties template
GraphParser
,VP,EP,VP,EP> read( adjacency_list
& g ) { return GraphParser
,VP,EP,VP,EP>(&g); } /// output stream for writing a graph template
std::ostream& operator << ( std::ostream& out, const GraphPrinter
& gp ) { gp(out); return out; } /// write the graph with given property subsets template
GraphPrinter
,VPS,EPS> write( const adjacency_list
& g, VPS, EPS ) { return GraphPrinter
,VPS,EPS>(g); } /// write the graph with all internal vertex and edge properties template
GraphPrinter
,VP,EP> write( const adjacency_list
& g ) { return GraphPrinter
,VP,EP>(g); } // user methods //========================================================================= }// boost #endif
adjacency_list_io.hpp
Page URL
File URL
Prev
4/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.