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


#if !defined(_SPSMIX_H_)

#define _SPSMIX_H_

#include <absmix.h>
#include <spsstruc.h>
#include <shrfam.h>


class mixedGraph : public virtual abstractMixedGraph
{                                 
    friend class sparseGraphStructure;
    
protected:
        
    sparseGraphStructure X;    

public:

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

    unsigned long   Size() throw();
    unsigned long   Allocated() throw();
    virtual objectType ClassID() throw() {return IDMixedGraph;};
    virtual void*   BackCast() {return (void*)this;};

    TArc            InsertArc(TNode u,TNode v) throw(ERRange,ERRejected)
                        {ReleaseAdjacencies(); m++; return X.InsertArc(u,v);};
    TArc            InsertArc(TNode u,TNode v,TCap uu,TFloat cc) throw(ERRange,ERRejected)
                        {ReleaseAdjacencies(); m++; return X.InsertArc(u,v,uu,0,cc);};
    TArc            InsertArc(TNode u,TNode v,TCap uu,TCap ll,TFloat cc) throw(ERRange,ERRejected)
                        {ReleaseAdjacencies(); m++; return X.InsertArc(u,v,uu,ll,cc);};
    void            DeleteArc(TArc a) throw(ERRange)
                        {ReleaseAll(); X.DeleteArc(a); ni = X.NI(); m = X.M();};

    void            SetOrientation(TArc a,char oo) throw(ERRange)
                        {X.SetOrientation(a,oo);};     

    #include <spsincl.h>

    TFloat          Length(TArc a) throw(ERRange)
                        {if (a&1) return -X.Length(a); else return X.Length(a);};     

};                           


class inducedSubgraph : public mixedGraph
{                                        
public:

    inducedSubgraph(abstractMixedGraph&,TNode,TOption = OPT_PARALLELS) throw(ERRejected);

};


class colourContraction : public mixedGraph
{                                        
public:

    colourContraction(abstractMixedGraph&,TOption = 0) throw();

};


class explicitSurfaceGraph : public mixedGraph
{                                        
public:

    explicitSurfaceGraph(abstractMixedGraph&,shrinkingFamily<TNode>&,
            TFloat*,TArc*) throw();
    
    void            ConfigDisplay(goblinController &) throw();

};

#endif
