30 #ifndef __CLAW_GRAPH_HPP__
31 #define __CLAW_GRAPH_HPP__
59 virtual const char* what()
const throw();
63 const std::string m_msg;
78 template <
class S,
class A = meta::no_type,
class Comp = std::less<S> >
97 typedef std::map<vertex_type, neighbours_list, vertex_compare>
108 friend class graph<vertex_type, edge_type, vertex_compare>;
111 typedef const vertex_type value_type;
112 typedef const vertex_type& reference;
113 typedef const vertex_type*
const pointer;
114 typedef ptrdiff_t difference_type;
116 typedef std::bidirectional_iterator_tag iterator_category;
125 reference operator*()
const;
126 pointer operator->()
const;
136 typename graph_content::const_iterator m_iterator;
146 friend class graph<vertex_type, edge_type, vertex_compare>;
159 const edge_type& label()
const;
160 const vertex_type& source()
const;
161 const vertex_type& target()
const;
164 void set(
const edge_type& l,
const vertex_type& s,
165 const vertex_type& t );
168 edge_type
const* m_label;
169 vertex_type
const* m_source;
170 vertex_type
const* m_target;
176 typedef const edge*
const pointer;
177 typedef ptrdiff_t difference_type;
179 typedef std::bidirectional_iterator_tag iterator_category;
188 reference operator*()
const;
189 pointer operator->()
const;
196 typename graph_content::const_iterator it_end,
197 typename graph_content::const_iterator it_s,
198 typename neighbours_list::const_iterator it_d );
202 typename graph_content::const_iterator m_vertex_begin;
205 typename graph_content::const_iterator m_vertex_end;
208 typename graph_content::const_iterator m_vertex_iterator;
211 typename neighbours_list::const_iterator m_neighbours_iterator;
222 typedef std::reverse_iterator<vertex_iterator> reverse_vertex_iterator;
223 typedef std::reverse_iterator<edge_iterator> reverse_edge_iterator;
228 void add_edge(
const vertex_type& s1,
const vertex_type& s2,
230 void add_vertex(
const vertex_type& s );
232 bool edge_exists(
const vertex_type& s,
const vertex_type& r )
const;
233 void neighbours(
const vertex_type& s, std::vector<vertex_type>& v )
const;
234 void vertices( std::vector<vertex_type>& v )
const;
236 vertex_iterator vertex_begin()
const;
237 vertex_iterator vertex_end()
const;
238 vertex_iterator vertex_begin(
const vertex_type& s )
const;
240 reverse_vertex_iterator vertex_rbegin()
const;
241 reverse_vertex_iterator vertex_rend()
const;
242 reverse_vertex_iterator vertex_rbegin(
const vertex_type& s )
const;
244 edge_iterator edge_begin()
const;
245 edge_iterator edge_end()
const;
246 edge_iterator edge_begin(
const vertex_type& s1,
247 const vertex_type& s2 )
const;
249 reverse_edge_iterator edge_rbegin()
const;
250 reverse_edge_iterator edge_rend()
const;
251 reverse_edge_iterator edge_rbegin(
const vertex_type& s1,
252 const vertex_type& s2 )
const;
254 const edge_type& label(
const vertex_type& s,
const vertex_type& r )
const;
256 std::size_t outer_degree(
const vertex_type& s )
const;
257 std::size_t inner_degree(
const vertex_type& s )
const;
258 std::size_t vertices_count()
const;
259 std::size_t edges_count()
const;
266 std::map<vertex_type, std::size_t, vertex_compare> m_inner_degrees;
269 std::size_t m_edges_count;
275 #include <claw/impl/graph.tpp>
277 #endif // __CLAW_GRAPH_HPP__
Iterator on the graph's edges.
S vertex_type
Type of the vertices.
A edge_type
Type of the edges.
Value pointed by the iterator.
Comp vertex_compare
Binary predicate to compare vertices.
Iterator on the graph's vertices.
std::map< vertex_type, neighbours_list, vertex_compare > graph_content
The whole graph: an adjacency list for each vertex.
An empty class not considered as a effective type.
claw::graph< vertex_type, edge_type, vertex_compare > self_type
Type of the current structure.
The exceptions thrown by the graphs.
std::map< vertex_type, edge_type, vertex_compare > neighbours_list
The adjacency list of a vertex. vertex_type is the target vertex, edge_type is the label on the edge...
A class to represent a graph.
This is the main namespace.