81 template <
class S,
class A,
class Comp>
92 template <
class S,
class A,
class Comp>
105 template <
class S,
class A,
class Comp>
119 template <
class S,
class A,
class Comp>
132 template <
class S,
class A,
class Comp>
146 template <
class S,
class A,
class Comp>
147 typename claw::graph<S, A, Comp>::graph_vertex_iterator::reference
150 return m_iterator->first;
158 template <
class S,
class A,
class Comp>
159 typename claw::graph<S, A, Comp>::graph_vertex_iterator::pointer
162 return &(m_iterator->first);
171 template <
class S,
class A,
class Comp>
175 return m_iterator == it.m_iterator;
184 template <
class S,
class A,
class Comp>
185 bool claw::graph<S, A, Comp>::graph_vertex_iterator::operator!=
188 return m_iterator != it.m_iterator;
196 template <
class S,
class A,
class Comp>
198 (
typename graph_content::const_iterator it)
211 template <
class S,
class A,
class Comp>
213 : m_label(NULL), m_source(NULL), m_target(NULL)
222 template <
class S,
class A,
class Comp>
226 assert(m_label != NULL);
234 template <
class S,
class A,
class Comp>
238 assert(m_source != NULL);
246 template <
class S,
class A,
class Comp>
250 assert(m_target != NULL);
258 template <
class S,
class A,
class Comp>
274 template <
class S,
class A,
class Comp>
285 template <
class S,
class A,
class Comp>
290 ++m_neighbours_iterator;
293 if ( m_neighbours_iterator == m_vertex_iterator->second.end() )
299 while ( (m_vertex_iterator != m_vertex_end) && !ok )
300 if ( !m_vertex_iterator->second.empty() )
303 m_neighbours_iterator = m_vertex_iterator->second.begin();
310 m_edge.set( m_neighbours_iterator->second, m_vertex_iterator->first,
311 m_neighbours_iterator->first );
321 template <
class S,
class A,
class Comp>
335 template <
class S,
class A,
class Comp>
341 if (m_vertex_iterator == m_vertex_end)
344 m_neighbours_iterator = m_vertex_iterator->second.end();
348 if ( m_neighbours_iterator == m_vertex_iterator->second.begin() )
352 while ( (m_vertex_iterator != m_vertex_begin) && !ok )
355 if ( !m_vertex_iterator->second.empty() )
358 m_neighbours_iterator = --m_vertex_iterator->second.end();
363 --m_neighbours_iterator;
366 m_vertex_iterator == m_vertex_end;
368 m_edge.set( m_neighbours_iterator->second, m_vertex_iterator->first,
369 m_neighbours_iterator->first );
379 template <
class S,
class A,
class Comp>
393 template <
class S,
class A,
class Comp>
405 template <
class S,
class A,
class Comp>
406 typename claw::graph<S, A, Comp>::graph_edge_iterator::pointer
418 template <
class S,
class A,
class Comp>
423 if ( m_vertex_begin == m_vertex_end )
424 return (it.m_vertex_begin == it.m_vertex_end)
425 && (m_vertex_begin == it.m_vertex_begin);
427 if ( it.m_vertex_begin == it.m_vertex_end )
431 if (m_vertex_iterator == m_vertex_end)
432 return (it.m_vertex_iterator == it.m_vertex_end)
433 && (m_vertex_begin == it.m_vertex_begin);
435 if (it.m_vertex_iterator == it.m_vertex_end)
438 return m_neighbours_iterator == it.m_neighbours_iterator;
447 template <
class S,
class A,
class Comp>
448 bool claw::graph<S, A, Comp>::graph_edge_iterator::operator!=
451 return !(*
this == it);
462 template <
class S,
class A,
class Comp>
464 (
typename graph_content::const_iterator it_begin,
465 typename graph_content::const_iterator it_end,
466 typename graph_content::const_iterator it_s,
467 typename neighbours_list::const_iterator it_d)
468 : m_vertex_begin(it_begin), m_vertex_end(it_end),
469 m_vertex_iterator(it_s), m_neighbours_iterator(it_d)
471 if (m_vertex_begin != m_vertex_end)
472 m_edge.set( m_neighbours_iterator->second, m_vertex_iterator->first,
473 m_neighbours_iterator->first );
483 template <
class S,
class A,
class Comp>
497 template <
class S,
class A,
class Comp>
501 if ( !edge_exists(s1, s2) )
510 ++m_inner_degrees[s2];
521 template <
class S,
class A,
class Comp>
524 std::pair<S, neighbours_list> p;
526 if (m_edges.find(s) == m_edges.end())
531 m_inner_degrees[s] = 0;
541 template <
class S,
class A,
class Comp>
545 typename graph_content::const_iterator it = m_edges.find(s);
547 if ( it == m_edges.end() )
550 return it->second.find(r) != it->second.end();
559 template <
class S,
class A,
class Comp>
563 typename graph_content::const_iterator it_s = m_edges.find(s);
566 if ( it_s != m_edges.end() )
568 v.resize( it_s->second.size() );
569 std::transform( it_s->second.begin(), it_s->second.end(), v.begin(),
579 template <
class S,
class A,
class Comp>
583 v.resize(m_edges.size());
585 std::transform( m_edges.begin(), m_edges.end(), v.begin(),
594 template <
class S,
class A,
class Comp>
605 template <
class S,
class A,
class Comp>
617 template <
class S,
class A,
class Comp>
629 template <
class S,
class A,
class Comp>
630 typename claw::graph<S, A, Comp>::reverse_vertex_iterator
633 return reverse_vertex_iterator( vertex_end() );
640 template <
class S,
class A,
class Comp>
641 typename claw::graph<S, A, Comp>::reverse_vertex_iterator
644 return reverse_vertex_iterator( vertex_begin() );
652 template <
class S,
class A,
class Comp>
653 typename claw::graph<S, A, Comp>::reverse_vertex_iterator
658 if (it != vertex_end())
661 return reverse_vertex_iterator( it );
669 template <
class S,
class A,
class Comp>
674 typename graph_content::const_iterator it_s;
675 it_s = m_edges.begin();
677 while ( (it_s != m_edges.end()) && !ok )
678 if ( it_s->second.empty() )
685 it_s->second.begin() );
695 template <
class S,
class A,
class Comp>
699 return edge_iterator( m_edges.begin(), m_edges.end(), m_edges.end(),
700 typename neighbours_list::const_iterator() );
708 template <
class S,
class A,
class Comp>
713 if ( edge_exists(s1, s2) )
715 typename graph_content::const_iterator it_s1;
717 it_s1 = m_edges.find(s1);
719 it_s1->second.find(s2) );
730 template <
class S,
class A,
class Comp>
731 typename claw::graph<S, A, Comp>::reverse_edge_iterator
734 return reverse_edge_iterator( edge_end() );
741 template <
class S,
class A,
class Comp>
742 typename claw::graph<S, A, Comp>::reverse_edge_iterator
745 return reverse_edge_iterator( edge_begin() );
753 template <
class S,
class A,
class Comp>
754 typename claw::graph<S, A, Comp>::reverse_edge_iterator
758 reverse_edge_iterator it = edge_begin(s1, s2);
760 if ( it != edge_end() )
763 return reverse_edge_iterator( it );
772 template <
class S,
class A,
class Comp>
777 typename graph_content::const_iterator it_s = m_edges.find(s);
779 if ( it_s == m_edges.end() )
781 (
"claw::graph::label(): unkonwn source vertex.");
784 typename neighbours_list::const_iterator it_r = it_s->second.find(r);
786 if ( it_r == it_s->second.end() )
788 (
"claw::graph::label(): destination is not a neighbor.");
799 template <
class S,
class A,
class Comp>
802 typename graph_content::const_iterator it = m_edges.find(s);
804 if (it == m_edges.end())
807 return it->second.size();
815 template <
class S,
class A,
class Comp>
818 typename std::map<S, std::size_t, Comp>::const_iterator it;
819 it = m_inner_degrees.find(s);
821 if (it == m_inner_degrees.end())
823 (
"claw::graph::inner_degree(): unkown vertex.");
832 template <
class S,
class A,
class Comp>
835 return m_edges.size();
842 template <
class S,
class A,
class Comp>
845 return m_edges_count;