00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef _SST_GRAPH_H_
00014 #define _SST_GRAPH_H_
00015
00016 #include <map>
00017 #include <list>
00018
00019
00020 namespace SST {
00021
00022 const char GRAPH_COMP_NAME[] = "comp_name";
00023 const char GRAPH_LINK_NAME[] = "link_name";
00024 const char GRAPH_WEIGHT[] = "weight";
00025 const char GRAPH_RANK[] = "rank";
00026 const char GRAPH_ID[] = "id";
00027
00028 class PropList {
00029 public:
00030 void set( std::string name, std::string value ) {
00031 map[name] = value;
00032 }
00033 std::string &get( std::string name ) {
00034 return map[name];
00035 }
00036 private:
00037 std::map<std::string,std::string> map;
00038 };
00039
00040 class Vertex {
00041 public:
00042 Vertex() : _id(++count) {};
00043 PropList prop_list;
00044 int id() { return _id; }
00045 std::list<int> adj_list;
00046
00047 private:
00048 static int count;
00049 int _id;
00050 };
00051
00052 class Edge {
00053
00054 static int count;
00055 int _id;
00056
00057 unsigned int vertex[2];
00058
00059 public:
00060 Edge( int v0, int v1 ) : _id(++count) {
00061 vertex[0] = v0;
00062 vertex[1] = v1;
00063 }
00064 PropList prop_list;
00065 int id(void) { return _id; }
00066
00067 unsigned int v( int index) { return vertex[index]; }
00068 };
00069
00070 typedef std::map<int, Edge*> EdgeList_t;
00071 typedef std::map<int, Vertex*> VertexList_t;
00072
00073 class Graph {
00074 public:
00075 EdgeList_t elist;
00076 VertexList_t vlist;
00077 Graph(int x) {;};
00078 int num_vertices(void) { return vlist.size(); }
00079 };
00080
00081 }
00082
00083 #endif