
/*
**  This file forms part of the GOBLIN C++ Class Library.
**
**  Written by Christian Fremuth-Paeger, February 1999.
**  
**  Copying, compiling, distribution and modification
**  of this source code is permitted only in accordance
**  with the GOBLIN general licence information.
*/             


#if !defined(_SHRNET_H_)

#define _SHRNET_H_

#include <absbal.h>
#include <auxnet.h>
#include <dynstaq.h>


class layeredShrNetwork : public layeredAuxNetwork
{
friend class iLayeredAuxNetwork;

private:

    abstractBalancedFNW &   H;
    
    dynamicStack<TNode,TFloat> *          LeftSupport;
    dynamicStack<TNode,TFloat> *          RightSupport;
    staticQueue<TNode,TFloat> **          Q;
    staticQueue<TArc,TFloat>  **          Anomalies;
    staticQueue<TArc,TFloat>  **          Bridges;
    iLayeredAuxNetwork *    LI;
    iLayeredAuxNetwork *    RI;
    
    TNode *                 breakPoint;
    TArc *                  leftProp;
    TArc *                  rightProp;
    TArc *                  firstProp;
    TArc *                  petal;

public:

    layeredShrNetwork(abstractBalancedFNW &HC,TArc *PP,TFloat *dd,TNode ss,
                        staticQueue<TNode,TFloat> **Q,
                        staticQueue<TArc,TFloat> **Anomalies,
                        staticQueue<TArc,TFloat> **Bridges) throw();
    ~layeredShrNetwork() throw();
    
    void            Init() throw();
    unsigned long   Size() throw();
    unsigned long   Allocated() throw();

    TNode           StartNode(TArc a) throw(ERRange);
    TCap            UCap(TArc a) throw(ERRange);

    TNode           DDFS(TArc a) throw(ERRange);
    void            ShrinkBlossom(TNode b,TArc currentPetal,TFloat tenacity)
                        throw(ERRange);

    TFloat          FindPath(TNode t) throw(ERRange,ERRejected);
    void            Expand(TNode x,TNode y) throw();
    void            CoExpand(TNode x,TNode y) throw();
    void            Traverse(TNode b,TNode x,TNode y,TArc currentPetal,
                        TArc *thisProp,TArc *otherProp) throw();

    void            Augment(TArc currentPetal) throw();
};                           


#endif

