• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

sst/core/graph.h

00001 // Copyright 2009-2010 Sandia Corporation. Under the terms
00002 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S.
00003 // Government retains certain rights in this software.
00004 // 
00005 // Copyright (c) 2009-2010, Sandia Corporation
00006 // All rights reserved.
00007 // 
00008 // This file is part of the SST software package. For license
00009 // information, see the LICENSE file in the top level directory of the
00010 // distribution.
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 } // namespace SST
00083 
00084 #endif

Generated on Fri Oct 22 2010 11:02:13 for SST by  doxygen 1.7.1