|
core/IdUndirectedGraph.hGo to the documentation of this file.00001 //============================================================================ 00002 // Author : Alessandro Pinto <apinto@eecs.berkeley.edu> 00003 // University of California, Berkeley 00004 // 545 Cory Hall, Berkeley, CA 94720 00005 // Copyright : See COPYING file that comes with this distribution 00006 //============================================================================ 00007 00008 #ifndef IDUNDIRECTEDGRAPH_H_ 00009 #define IDUNDIRECTEDGRAPH_H_ 00010 00011 #include <string> 00012 #include <sstream> 00013 #include <list> 00014 #include <set> 00015 #include "core/IdGraph.h" 00016 00017 namespace cosi { 00018 00019 class IdUndirectedGraph { 00020 00021 public: 00022 00023 IdUndirectedGraph(std::string pName); 00024 00025 virtual ~IdUndirectedGraph(); 00026 00027 int Degree(int r); 00028 00029 Vertex AddVertex() ; 00030 00031 int GetLastId( ) ; 00032 00033 void AddVertex(int Id); 00034 00035 void DeleteVertex(int Id); 00036 00037 bool InV(int V); 00038 00039 bool InE(int i, int j); 00040 00041 bool InE(Edge pE); 00042 00043 void AddEdge(int i, int j); 00044 00045 void AddEdge(Edge pE); 00046 00047 void DeleteEdge(int i, int j); 00048 00049 void DeleteEdge(Edge pE); 00050 00051 int Order(); 00052 00053 int Size(); 00054 00055 typedef std::list<int>::iterator list_iterator; 00056 typedef std::set<int>::iterator v_iterator; 00057 00060 list_iterator adj_begin(int V); 00063 list_iterator adj_end(int V); 00064 00066 v_iterator v_begin(); 00068 v_iterator v_end(); 00069 00071 std::string GetName() const; 00072 00074 void SetName(std::string pName); 00075 00077 void SetName(int V, std::string pName); 00078 00080 void SetName(int U, int V, std::string pName); 00081 00082 void SetName(Edge pE, std::string pName); 00083 00085 std::string GetName(int V); 00086 00088 std::string GetName(int U, int V); 00089 00090 std::string GetName(Edge pE); 00091 00092 virtual string Print(); 00093 00094 virtual string PrintNode(int V); 00095 00096 virtual string PrintEdge(int U, int V); 00097 00098 virtual string PrintEdge(Edge pE); 00099 00100 private: 00102 std::map< int , std::list<int> > mAdjList; 00103 00104 std::set<int> mV; 00106 int mSize; 00108 string mName; 00109 00110 std::map< int , std::string > mNodeName; 00111 std::map< std::pair<int,int> , std::string > mEdgeName; 00112 00113 int mLastId ; 00114 00115 }; 00116 00117 } 00118 00119 #endif /*IDUNDIRECTEDGRAPH_H_*/ Generated on Sun Sep 7 18:37:42 2008 for COSI by 1.5.4 |