
/*
**  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(_SPSGRA_H_)

#define _SPSGRA_H_

#include "absgra.h"
#include "spsstruc.h"


class graph : public virtual abstractGraph
{
    friend class sparseGraphStructure;
    
private:
    
    bool mode; 
    
protected:
        
    sparseGraphStructure X;    

public:

    graph(TNode,TOption = 0,goblinController& = goblinDefaultContext,
        bool = false) throw();
    graph(const char*,goblinController& = goblinDefaultContext)
        throw(ERFile,ERParse);
    graph(abstractMixedGraph&,TOption = 0) throw();
    ~graph() throw();
                    
    unsigned long   Size() throw();
    unsigned long   Allocated() throw();
    virtual objectType ClassID() throw() {return IDSparseGraph;};
    virtual void*   BackCast() {return (void*)this;};

    TArc    InsertArc(TNode u,TNode v)
                throw(ERRange,ERRejected);
    TArc    InsertArc(TNode u,TNode v,TCap uu,TFloat cc)
                throw(ERRange,ERRejected);
    TArc    InsertArc(TNode u,TNode v,TCap uu,TCap ll,TFloat cc)
                throw(ERRange,ERRejected);
    void DeleteArc(TArc a) throw(ERRange);
    
    void            ChinesePostman() throw();

    #include <spsincl.h>

    #include <deleteNode.h>

    TFloat          Length(TArc a) throw(ERRange)
                        {return X.Length(a);};     

};                           


class complementaryGraph : public graph
{                                        
public:

    complementaryGraph(abstractMixedGraph&,TOption = 0) throw(ERRejected);

};


class lineGraph : public graph
{                                        
public:

    lineGraph(abstractMixedGraph&,TOption = 0) throw(ERRejected);

};


class dualGraph : public graph
{                                        
public:

    dualGraph(abstractMixedGraph&,TOption = 0) throw(ERRejected);

};


class tiling : public graph
{                                        
public:

    tiling(abstractMixedGraph&,TOption,TNode,TNode) throw();
    
    TNode Index(TNode,TNode,TNode,TNode,TNode) throw();

};


class voronoiDiagram : public graph
{                                        
private:

    abstractMixedGraph& G;
    TArc*               revMap;
    
public:

    voronoiDiagram(abstractMixedGraph&) throw();
    ~voronoiDiagram() throw();
    
    TFloat UpdateSubgraph() throw();

};


class triangularGraph : public graph
{                                        
public:

    triangularGraph(TNode,TOption,goblinController& = goblinDefaultContext) throw();

};


#endif
