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 rank;
00045 int id() { return _id; }
00046 std::list<int> adj_list;
00047
00048 private:
00049 static int count;
00050 int _id;
00051 };
00052
00053 class Edge {
00054
00055 static int count;
00056 int _id;
00057
00058 unsigned int vertex[2];
00059
00060 public:
00061 Edge( int v0, int v1 ) : _id(++count) {
00062 vertex[0] = v0;
00063 vertex[1] = v1;
00064 }
00065 PropList prop_list;
00066 int id(void) { return _id; }
00067
00068 unsigned int v( int index) { return vertex[index]; }
00069 };
00070
00071 typedef std::map<int, Edge*> EdgeList_t;
00072 typedef std::map<int, Vertex*> VertexList_t;
00073
00074 class Graph {
00075 public:
00076 EdgeList_t elist;
00077 VertexList_t vlist;
00078 Graph(int x) {;};
00079 int num_vertices(void) { return vlist.size(); }
00080 };
00081
00082 }
00083
00084 #endif