Main Page | Class Hierarchy | Data Structures | File List | Data Fields | Globals

ConstGraph.hpp

Go to the documentation of this file.
00001 // vim:sw=2:ts=8
00019 #ifndef CONST_GRAPH__HPP
00020 #define CONST_GRAPH__HPP
00021 
00022 #include <map>
00023 #include <deque>
00024 #include "boost/graph/adjacency_list.hpp"
00025 
00026 #include "def_graph.hpp"
00027 #include "PropertyFacility.hpp"
00028 
00029 
00030 namespace gns {
00031 
00032 
00066   class ConstGraph
00067   {
00068     protected:
00070       Graph_t *graph;
00072       PropertyFacility *prop;
00073 
00075       typedef std::hash_map<NodeID, Node> id_node_map_t;
00077       typedef std::hash_map<EdgeID, Edge> id_edge_map_t;
00078 
00080       typedef std::hash_map<Node, NodeID> node_id_map_t;
00081       //typedef boost::property_map<Graph_t, boost::vertex_index_t>::type node_id_map_t;
00083       typedef std::hash_map<Edge, EdgeID> edge_id_map_t;
00084       //typedef boost::property_map<Graph_t, boost::edge_index_t>::type edge_id_map_t;
00085 
00087       node_id_map_t node_id_map;
00089       id_node_map_t id_node_map;
00090 
00092       edge_id_map_t edge_id_map;
00094       id_edge_map_t id_edge_map;
00095 
00096 
00097     public:
00099       ConstGraph();
00101       ConstGraph(PropertyFacility *p);
00103       ConstGraph(const ConstGraph &g);
00104 
00106       virtual ~ConstGraph();
00107 
00108 
00110       virtual bool node_exists(Node n) const;
00111 
00113       virtual bool node_exists(NodeID id) const;
00114 
00116       virtual Node node(const NodeID id) const;
00117 
00119       virtual NodeID node_id(const Node n) const;
00120 
00122       virtual void node_id(Node n, const NodeID id);
00123 
00125       virtual bool edge_exists(Edge e) const;
00126 
00128       virtual bool edge_exists(const EdgeID id) const;
00129       
00131       virtual Edge edge(const EdgeID id) const;
00132 
00134       virtual Edge edge(const Node u, const Node v) const;
00135 
00137       virtual EdgeID edge_id(const Edge e) const;
00138 
00140       virtual void edge_id(Edge e, const EdgeID id);
00141 
00143       /*void rebuild_node_ids();*/
00144 
00146       virtual void print() const;
00147 
00148 
00150       long num_nodes() const;
00151 
00153       long num_edges() const;
00154 
00156       long indeg(const Node n) const;
00157 
00159       long outdeg(const Node n) const;
00160 
00162       Node source(const Edge e) const;
00163 
00165       Node target(const Edge e) const;
00166 
00168       Node opposite(const Edge e, const Node n) const;
00169 
00171       NodeIter first_node() const;
00172 
00174       NodeIter last_node() const;
00175 
00177       EdgeIter first_edge() const;
00178 
00180       EdgeIter last_edge() const;
00181 
00183       OutEdgeIter first_out_edge(const Node n) const;
00184 
00186       OutEdgeIter last_out_edge(const Node n) const;
00187 
00189       InEdgeIter first_in_edge(const Node n) const;
00190 
00192       InEdgeIter last_in_edge(const Node n) const;
00193 
00195       PropertyFacility* properties() const;
00196 
00198       bool valid_node(Node n) const;
00199 
00201       bool valid_edge(Edge e) const;
00202 
00203 
00204 
00205     protected:
00206 
00208       virtual Node priv_new_node(NodeID id = "");
00209 
00211       virtual void priv_del_node(Node n);
00212 
00214       virtual Edge priv_new_edge(Node u, Node v, EdgeID id = "");
00215 
00217       virtual void priv_del_edge(Edge e);
00218 
00220       virtual void priv_del_edge(Node u, Node v);
00221  
00223       virtual void priv_add_nodes(int num, int start);
00224 
00226       virtual std::map<Node, Node>* init_copy(const ConstGraph *g, bool return_map);
00227 
00229       virtual void init(PropertyFacility *p);
00230 
00231   };
00232 
00233 
00234 }
00235 
00236 #endif

Generated on Sun Nov 5 12:05:19 2006 for Graph by  doxygen 1.4.1