COIN-OR::LEMON - Graph Library

Changeset 3:272a5677bd6d in lemon-0.x for src/include/graph.h


Ignore:
Timestamp:
12/13/03 16:44:50 (19 years ago)
Author:
Alpar Juttner
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@15
Message:
  • Marci type iterator constructors
  • src/demo/bfsdemo.cc: demo for bfs.h
  • cosmetical changes
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/include/graph.h

    r2 r3  
    5858     
    5959      NodeIterator() {;}
     60      NodeIterator(Graph<N,E> &Gr)//'const Graph<N,E> &G' would be wrong.
     61      {G=&Gr;n=Gr.OldGraph<N,E>::FirstNode();}
    6062      NodeIterator(const NodeIterator &i) {G=i.G;n=i.n;}
    6163     
     
    149151    {
    150152    public:
     153      InEdgeIterator() {}
     154      InEdgeIterator(const Graph<N,E> &Gr,const NodeIterator &n)
     155      { G=&Gr; e=Gr.OldGraph<N,E>::FirstIn(n.n);}
     156
    151157      InEdgeIterator &GoNext() { e=e->NextIn(); return *this;}
    152158      InEdgeIterator Next() const {return InEdgeIterator(*this).GoNext();}
     
    170176    {
    171177    public:
     178      OutEdgeIterator() {}
     179      OutEdgeIterator(Graph<N,E> &Gr,const NodeIterator &n)
     180      { G=&Gr; e=Gr.OldGraph<N,E>::FirstOut(n.n);}
     181
    172182      OutEdgeIterator &GoNext() { e=e->NextOut(); return *this;}
    173183      OutEdgeIterator Next() const {return OutEdgeIterator(*this).GoNext();}
     
    193203     
    194204    public:
     205      SymEdgeIterator() {}
     206      SymEdgeIterator(const Graph<N,E> &Gr,const NodeIterator &nn)
     207      { G=&Gr; n=nn; e=Gr.FirstSym(nn.n); }
     208
    195209      SymEdgeIterator &GoNext() { e=e->NextEdge(n.n); return *this;}
    196210      SymEdgeIterator Next() const {return SymEdgeIterator(*this).GoNext();}
     
    217231     
    218232    public:
     233      AllEdgeIterator() {}
     234      AllEdgeIterator(Graph<N,E> &Gr) : n(Gr)
     235      {
     236        e=n.isValid()?Gr.OldGraph<N,E>::FirstOut(n.n):NULL;
     237      } 
     238
    219239      AllEdgeIterator &GoNext()
    220240      {
     
    249269    typedef SymEdgeIterator DeletingSymEdgeIterator;
    250270   
    251     const NodeIterator &FirstNode()
     271    const NodeIterator FirstNode()
    252272    {
    253273      NodeIterator i;
     
    285305   
    286306    //Vagy beginnode()?
    287     const DeletingEdgeIterator &FirstOut(const NodeIterator &n)
     307    const DeletingEdgeIterator FirstOut(const NodeIterator &n)
    288308    {
    289309      EdgeIterator i;
     
    291311      return i;
    292312    }
    293     const DeletingEdgeIterator &FirstIn(const NodeIterator &n)
     313    const DeletingEdgeIterator FirstIn(const NodeIterator &n)
    294314    {
    295315      EdgeIterator i;
     
    297317      return i;
    298318    }
    299     const DeletingSymEdgeIterator &FirstSym(const NodeIterator &n)
     319    const DeletingSymEdgeIterator FirstSym(const NodeIterator &n)
    300320    {
    301321      EdgeIterator i;
     
    369389   
    370390    int NodeNum() { OldGraph<N,E>::NodeNum(); }
    371     int Clean() { OldGraph<N,E>::Clean(); }
     391    void Clean() { OldGraph<N,E>::Clean(); }
    372392
    373393    Graph() : _FST(this) {}
Note: See TracChangeset for help on using the changeset viewer.