00001 // Copyright (C) 2005 Alexander Ushakov 00002 // Contents: Definition of class Graph 00003 // 00004 // Principal Authors: Alexander Ushakov 00005 // 00006 // Revision History: 00007 // 00008 00009 #ifndef _Graph_H_ 00010 #define _Graph_H_ 00011 00012 00013 #include "ObjectOf.h" 00014 #include "GraphRep.h" 00015 #include "vector" 00016 using namespace std; 00017 00018 00019 00020 //---------------------------------------------------------------------------// 00021 //---------------------------------- Graph ----------------------------------// 00022 //---------------------------------------------------------------------------// 00023 00024 00025 class Graph : public ObjectOf< GraphRep > 00026 { 00027 00028 public: 00029 typedef GraphRep::state_type state_type; 00030 typedef GraphRep::edge_type edge_type; 00031 00033 // // 00034 // Constructors // 00035 // // 00037 public: 00038 00039 Graph( ) : ObjectOf< GraphRep >( new GraphRep() ) { } 00040 00042 // // 00043 // Accessors // 00044 // // 00046 public: 00047 00048 const map< int, state_type >& getStates( ) const { return look( )->getStates( ); } 00049 int newState( ) { return change( ) -> newState( ); } 00050 void newEdge( int v1 , int v2 ) { change( ) -> newEdge( v1 , v2 ); } 00051 void clear( ) { change( ) -> clear( ); } 00052 00053 00055 // // 00056 // I/O // 00057 // // 00059 private: 00060 00061 // ostream& operator << ( ostream& os , const Graph& g ); 00062 // Function is defined outside of the scope of GraphRep 00063 00065 // // 00066 // Operators // 00067 // // 00069 00070 }; 00071 00072 00073 ostream& operator << ( ostream& os , const Graph& g ); 00074 00076 Graph randomGraph( int N , float edge_param ); 00077 00079 vector< vector< int > > lengthTable( const Graph& G ); 00080 00082 vector< vector< int > > innerProductTable( const Graph& G , int origin ); 00083 00085 float getHyperbolicityConst( const Graph& G ); 00086 00087 #endif 00088