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


#if !defined(_DNSDIG_H_)

#define _DNSDIG_H_

#include <absdig.h>
#include <dnsstruc.h>


class denseDiGraph : public virtual abstractDiGraph
{
friend class iDenseDiGraph;
protected:
        
    denseGraphStructure X;    

public:

    denseDiGraph(TNode nn,TOption options = 0,
        goblinController &thisContext = goblinDefaultContext) throw();
    denseDiGraph(char* impFileName,
        goblinController &thisContext = goblinDefaultContext)
        throw(ERFile,ERParse);
    denseDiGraph(abstractDiGraph &G) throw();
    ~denseDiGraph() throw();

    TArc            InsertArc(TNode u,TNode v) throw(ERRange,ERRejected);
    TArc            InsertArc(TNode u,TNode v,TCap cc,TCap bb,TFloat ll)
                        throw(ERRange,ERRejected);

    unsigned long   Size() throw();
    unsigned long   Allocated() throw();
    virtual objectType ClassID() throw() {return IDDenseDiGraph;};
    virtual void*   BackCast() {return (void*)this;};
    
    TArc            Adjacency(TNode u,TNode v) throw(ERRange);
    TNode           StartNode(TArc a) throw(ERRange);
    TNode           EndNode(TArc a) throw(ERRange);
   
    TArc            First(TNode v) throw(ERRange);
    TArc            Right(TArc a,TNode u) throw(ERRange);
    
    void            Write(char* fileName) throw(ERFile)
                        {WriteDiGraph(fileName,NO_INCIDENCES);};

    #include <dnsincl.h>

    TFloat          Length(TArc a) throw(ERRange)
                        {if (a&1) return -X.Length(a); else return X.Length(a);};     
    
    TFloat          TSPHeuristics(TNode r = NoNode) throw(ERRange,ERRejected);

};                           


class distanceGraph : public denseDiGraph
{                                        
public:

    distanceGraph(abstractMixedGraph &G) throw(ERRejected);

};


#endif
