Main Page   Class Hierarchy   Compound List   File List   Compound Members  

edgeVector.h

00001 /****************************************************
00002  *  Bachelor Project:                               *
00003  *  External Memory Minimum Spanning Trees          *
00004  *  by Dominik Schultes <mail@dominik-schultes.de>  *
00005  *                                                  *
00006  *                edgeVector.h                      *
00007  *                                                  *
00008  *  April 13, 2003                                  *
00009  ****************************************************/
00010 
00011 
00012 #ifndef EDGEVECTOR_H
00013 #define EDGEVECTOR_H
00014 
00015 #include <iostream>
00016 
00017 #include "relabeledEdge.h"
00018 
00019 #include "../stxxl/containers/vector.h"
00020 
00021 typedef unsigned int EdgeCount;
00022 typedef unsigned int NodeCount;
00023 
00024 
00028 template <typename EdgeType = Edge,
00029           unsigned int blockSize = DS_DEFAULT_BLOCK_SIZE,
00030           unsigned int noOfPages = DS_DEFAULT_NO_OF_PAGES,
00031           unsigned int pageSize = DS_DEFAULT_PAGE_SIZE>
00032 class EdgeVector : public stxxl::VECTOR_GENERATOR<EdgeType, pageSize, noOfPages,
00033                                                   blockSize>::result
00034 {
00036     friend std::ostream& operator<<( std::ostream& os,
00037                                      EdgeVector<EdgeType,blockSize,noOfPages,pageSize> &el ) {
00038         os << el.noOfNodes() << " " << el.noOfEdges() << std::endl;
00039         for (EdgeCount i=0; i<el.noOfEdges(); i++)
00040             os << el[i] << std::endl;
00041         return os;
00042     }
00043     
00044  public:
00053     EdgeVector(NodeCount noOfNodes, EdgeCount noOfEdges)
00054         : _noOfNodes( noOfNodes )
00055         { reserve(noOfEdges); }
00056 
00058     EdgeCount noOfEdges() const {return size();}
00059 
00061     NodeCount noOfNodes() const {return _noOfNodes;}
00062 
00064     bool empty() const {return (noOfEdges() == 0);}
00065 
00066     
00068     void sortByWeight();
00069     
00070  private:
00071     NodeCount _noOfNodes;
00072 
00073 };
00074 
00075 
00080 typedef EdgeVector<RelabeledEdge> InternalMemoryBucket;
00081 
00082 
00083 #endif // EDGEVECTOR_H

Generated on Thu Aug 14 15:13:27 2003 for External Memory Minimum Spanning Trees by doxygen1.2.17