C++ Boost

IncidenceGraph

The IncidenceGraph concept provides an interface for efficient access to the out-edges of each vertex in the graph.

Refinement of

Graph

Notation

G A type that is a model of IncidenceGraph.
g An object of type G.
e An object of type boost::graph_traits<G>::edge_descriptor.
v An object of type boost::graph_traits<G>::vertex_descriptor.

Associated Types

Incidence Iterator Type boost::graph_traits<G>::out_edge_iterator An out-edge iterator for a vertex v provides access to the out-edges of the vertex. As such, the value type of an out-edge iterator is the edge descriptor type of its graph. An out-edge iterator must meet the requirements of MultiPassInputIterator.
Degree Size Type boost::graph_traits<G>::degree_size_type The unsigned intergral type used for representing the number out-edges or incident edges of a vertex.

Valid Expressions

NameExpressionReturn TypeDescription
Source Vertex source(e, g) vertex_descriptor Returns the vertex descriptor for u of the edge (u,v) represented by e.
Target Vertex target(e, g) vertex_descriptor Returns the vertex descriptor for v of the edge (u,v) represented by e.
Out-Edges of a Vertex out_edges(v, g) std::pair<out_edge_iterator, out_edge_iterator> Returns an iterator-range providing access to the out-edges (for directed graphs) or incident edges (for undirected graphs) of vertex v in graph g.
Out-degree of a Vertex out_degree(v, g) degree_size_type Returns the number of out-edges (for directed graphs) or the number of incident edges (for undirected graphs) of vertex v in graph g.

Complexity guarantees

The source(), target(), and out_edges() functions must all be constant time. The out_degree() function must be linear in the number of out-edges.

See Also

Graph concepts

Concept Checking Class

  template <class G>
  struct IncidenceGraph_concept
  {
    typedef typename boost::graph_traits<G>::out_edge_iterator out_edge_iterator;
    void constraints() {
      REQUIRE(G, Graph);
      REQUIRE(out_edge_iterator, MultiPassInputIterator);

      p = out_edges(v, g);
      e = *p.first;
      u = source(e, g);
      v = target(e, g);
    }
    void const_constraints(const G& g) {
      p = out_edges(v, g);
      e = *p.first;
      u = source(e, g);
      v = target(e, g);
    }
    std::pair<out_edge_iterator, out_edge_iterator> p;
    typename boost::graph_traits<G>::vertex_descriptor u, v;
    typename boost::graph_traits<G>::edge_descriptor e;
    G g;
  };


Copyright © 2000 Jeremy Siek, Univ.of Notre Dame (jsiek@lsc.nd.edu)
Lie-Quan Lee, Univ.of Notre Dame (llee1@lsc.nd.edu)
Andrew Lumsdaine, Univ.of Notre Dame (lums@lsc.nd.edu)