42 #ifndef VIGRA_GRAPH_GENERALIZATION_HXX 
   43 #define VIGRA_GRAPH_GENERALIZATION_HXX 
   47 #include "multi_gridgraph.hxx" 
   53     struct GraphMapTypeTraits{
 
   54         typedef typename MAP::value_type      Value;
 
   55         typedef typename MAP::reference       Reference;
 
   56         typedef typename MAP::const_reference ConstReference;
 
   63     struct GraphIteratorAccessor{
 
   65         typedef typename Graph::Node        Node;
 
   66         typedef typename Graph::NodeIt      NodeIt;
 
   67         typedef typename Graph::EdgeIt      EdgeIt;
 
   68         typedef typename Graph::ArcIt       ArcIt;
 
   69         typedef typename Graph::OutArcIt    OutArcIt;
 
   70         typedef typename Graph::IncEdgeIt   IncEdgeIt;
 
   72         static NodeIt nodesBegin(
const Graph & g){ 
return NodeIt(g);}
 
   73         static EdgeIt edgesBegin(
const Graph & g){ 
return EdgeIt(g);}
 
   74         static ArcIt  arcsBegin( 
const Graph & g){ 
return ArcIt( g);}
 
   75         static OutArcIt outArcBegin(
const Graph & g,
const Node & node){
 
   76             return OutArcIt(g,node);
 
   78         static IncEdgeIt incEdgeBegin(
const Graph & g,
const Node & node){
 
   79             return IncEdgeIt(g,node);
 
   83         static NodeIt nodesEnd(
const Graph &){ 
return NodeIt(lemon::INVALID);}
 
   84         static EdgeIt edgesEnd(
const Graph &){ 
return EdgeIt(lemon::INVALID);}
 
   85         static ArcIt  arcsEnd( 
const Graph &){ 
return ArcIt( lemon::INVALID);}
 
   86         static OutArcIt outArcEnd(
const Graph &,
const Node &){
 
   87             return OutArcIt(lemon::INVALID);
 
   89         static IncEdgeIt incEdgeEnd(
const Graph &,
const Node &){
 
   90             return IncEdgeIt(lemon::INVALID);
 
   97     template<
unsigned int DIM,
class DIRECTED_TAG>
 
   98     struct GraphIteratorAccessor<GridGraph<DIM,DIRECTED_TAG> >{
 
   99         typedef GridGraph<DIM,DIRECTED_TAG> Graph;
 
  100         typedef typename Graph::Node Node;
 
  101         typedef typename Graph::NodeIt NodeIt;
 
  102         typedef typename Graph::EdgeIt EdgeIt;
 
  103         typedef typename Graph::ArcIt  ArcIt;
 
  104         typedef typename Graph::OutArcIt OutArcIt;
 
  105         typedef typename Graph::IncEdgeIt   IncEdgeIt;
 
  107         static NodeIt   nodesBegin(
const Graph & g){ 
return NodeIt(g);}
 
  108         static EdgeIt   edgesBegin(
const Graph & g){ 
return g.get_edge_iterator();}
 
  109         static ArcIt    arcsBegin( 
const Graph & g){ 
return ArcIt( g);}
 
  110         static OutArcIt outArcBegin(
const Graph & g,
const Node & node){
 
  111             return g.get_out_edge_iterator(node);
 
  113          static IncEdgeIt incEdgeBegin(
const Graph & g,
const Node & node){
 
  114             return IncEdgeIt(g,node);
 
  117         static NodeIt   nodesEnd(
const Graph & g){ 
return g.get_vertex_end_iterator();}
 
  118         static EdgeIt   edgesEnd(
const Graph & g){ 
return g.get_edge_end_iterator();}
 
  119         static ArcIt    arcsEnd( 
const Graph & g){ 
return g.get_arc_end_iterator(); }
 
  120         static OutArcIt outArcEnd(
const Graph & g,
const Node & node){
 
  121             return g.get_out_edge_end_iterator(node);
 
  123         static IncEdgeIt incEdgeEnd(
const Graph &,
const Node &){
 
  124             return IncEdgeIt(lemon::INVALID);
 
  130     template<
class GRAPH>
 
  131     class IntrinsicGraphShape{
 
  135         typedef typename Graph::index_type  index_type;
 
  137         typedef typename Graph::Node Node ;
 
  138         typedef typename Graph::Edge Edge ;
 
  139         typedef typename  Graph::Arc  Arc ;
 
  141         typedef DiffType1d IntrinsicNodeMapShape;
 
  142         typedef DiffType1d IntrinsicEdgeMapShape;
 
  143         typedef DiffType1d  IntrinsicArcMapShape;
 
  145         static IntrinsicNodeMapShape intrinsicNodeMapShape(
const Graph & g){
 
  146             return IntrinsicNodeMapShape(g.maxNodeId()+1);
 
  148         static IntrinsicEdgeMapShape intrinsicEdgeMapShape(
const Graph & g){
 
  149             return IntrinsicEdgeMapShape(g.maxEdgeId()+1);
 
  151         static IntrinsicArcMapShape intrinsicArcMapShape(
const Graph & g){
 
  152             return  IntrinsicArcMapShape(g.maxArcId()+1);
 
  156         static const unsigned int IntrinsicNodeMapDimension=1;
 
  157         static const unsigned int IntrinsicEdgeMapDimension=1;
 
  158         static const unsigned int IntrinsicArcMapDimension=1;
 
  161     template<
unsigned int DIM,
class DIRECTED_TAG>
 
  162     class IntrinsicGraphShape<GridGraph<DIM,DIRECTED_TAG> >{
 
  164         typedef GridGraph<DIM,DIRECTED_TAG> Graph;
 
  165     typedef typename Graph::index_type  index_type;
 
  167         typedef typename Graph::Node Node ;
 
  168         typedef typename Graph::Edge Edge ;
 
  169         typedef typename  Graph::Arc  Arc ;
 
  171         typedef typename Graph::shape_type              IntrinsicNodeMapShape;
 
  172         typedef typename Graph::edge_propmap_shape_type IntrinsicEdgeMapShape;
 
  173         typedef typename Graph::edge_propmap_shape_type IntrinsicArcMapShape;
 
  175         static IntrinsicNodeMapShape intrinsicNodeMapShape(
const Graph & g){
 
  178         static IntrinsicEdgeMapShape intrinsicEdgeMapShape(
const Graph & g){
 
  179             return  g.edge_propmap_shape();
 
  181         static IntrinsicArcMapShape intrinsicArcMapShape(
const Graph & g){
 
  182             return  g.arc_propmap_shape();
 
  184         static const unsigned int IntrinsicNodeMapDimension=DIM;
 
  185         static const unsigned int IntrinsicEdgeMapDimension=DIM+1;
 
  186         static const unsigned int IntrinsicArcMapDimension=DIM+1;
 
  191     template<
class GRAPH>
 
  192     class GraphDescriptorToMultiArrayIndex{
 
  195     typedef typename Graph::index_type  index_type;
 
  197         typedef typename Graph::Node Node ;
 
  198         typedef typename Graph::Edge Edge ;
 
  199         typedef typename  Graph::Arc  Arc ;
 
  201         typedef typename IntrinsicGraphShape<Graph>::IntrinsicNodeMapShape IntrinsicNodeMapShape;
 
  202         typedef typename IntrinsicGraphShape<Graph>::IntrinsicEdgeMapShape IntrinsicEdgeMapShape;
 
  203         typedef typename IntrinsicGraphShape<Graph>::IntrinsicArcMapShape  IntrinsicArcMapShape;
 
  205         static IntrinsicNodeMapShape intrinsicNodeCoordinate(
const Graph & g,
const Node & node){
 
  206             return IntrinsicNodeMapShape(g.id(node));
 
  208         static IntrinsicEdgeMapShape intrinsicEdgeCoordinate(
const Graph & g,
const Edge & 
edge){
 
  209             return IntrinsicEdgeMapShape(g.id(edge));
 
  211         static IntrinsicArcMapShape intrinsicArcCoordinate(
const Graph & g,
const Arc & arc){
 
  212             return  IntrinsicArcMapShape(g.id(arc));
 
  219     template<
unsigned int DIM,
class DIRECTED_TAG>
 
  220     class GraphDescriptorToMultiArrayIndex<GridGraph<DIM,DIRECTED_TAG> >{
 
  222         typedef GridGraph<DIM,DIRECTED_TAG> Graph;
 
  223         typedef typename Graph::index_type  index_type;
 
  225         typedef typename Graph::Node Node ;
 
  226         typedef typename Graph::Edge Edge ;
 
  227         typedef typename  Graph::Arc  Arc ;
 
  229         typedef typename IntrinsicGraphShape<Graph>::IntrinsicNodeMapShape IntrinsicNodeMapShape;
 
  230         typedef typename IntrinsicGraphShape<Graph>::IntrinsicEdgeMapShape IntrinsicEdgeMapShape;
 
  231         typedef typename IntrinsicGraphShape<Graph>::IntrinsicArcMapShape  IntrinsicArcMapShape;
 
  234         static Node intrinsicNodeCoordinate(
const Graph &,
const Node & node){
 
  237         static Edge intrinsicEdgeCoordinate(
const Graph &,
const Edge & edge){
 
  240         static Arc  intrinsicArcCoordinate (
const Graph &,
const Arc & arc){
 
  252 #endif // VIGRA_GRAPH_GENERALIZATION_HXX 
view_type::difference_type difference_type
Definition: multi_array.hxx:2522
std::pair< typename vigra::GridGraph< N, DirectedTag >::edge_descriptor, bool > edge(typename vigra::GridGraph< N, DirectedTag >::vertex_descriptor const &u, typename vigra::GridGraph< N, DirectedTag >::vertex_descriptor const &v, vigra::GridGraph< N, DirectedTag > const &g)
Return the pair (edge_descriptor, true) when an edge between vertices u and v exists, or (lemon::INVALID, false) otherwise (API: boost). 
Definition: multi_gridgraph.hxx:2990