/* (C) Copyright 2003 Jens Lysgaard. All rights reserved. */
/* OSI Certified Open Source Software */
/* This software is licensed under the Common Public License Version 1.0 */

#ifndef _H_BASEGRPH
#define _H_BASEGRPH

typedef struct
{
  int CFN; /* Cardinality (number) of Forward Nodes */
  int CBN; /* Cardinality (number) of Backward Nodes */
  int FLD; /* Forward List Dimension (memory is allocated for <FLD> records */
  int BLD; /* Backward List Dimension (memory is allocated for <BLD> records */
  int *FAL; /* Forward Arc List */
  int *BAL; /* Backward Arc List */
} ReachNodeRec;

typedef struct
{
  int n;
  ReachNodeRec *LP; /* List Pointer */
} ReachTopRec;

typedef ReachTopRec *ReachPtr;

typedef struct
{
  int Row;
  int CFN;
  int *FAL;
} CompFReachNodeRec;

typedef struct
{
  int NoOfRows;
  CompFReachNodeRec *FLP;
} CompFReachRec;

typedef CompFReachRec *CompFReachPtr;

void WriteReachPtr(ReachPtr P);
void ReachInitMem(ReachPtr *P, int n);
void ReachPtrExpandDim(ReachPtr P, int NewN);
void ReachClearLists(ReachPtr P);
void ReachClearForwLists(ReachPtr P);
void ReachSetForwList(ReachPtr P, int *ArcList, int Row, int Arcs);
void ReachSetBackwList(ReachPtr P, int *ArcList, int Col, int Arcs);
void ReachCreateInLists(ReachPtr P);
void ReachAddArc(ReachPtr P, int Row, int Col);
void ReachAddForwArc(ReachPtr P, int Row, int Col);
void CopyReachPtr(ReachPtr SourcePtr, ReachPtr *SinkPtr);
void ReachFreeMem(ReachPtr *P);
void WriteCompPtr(CompFReachPtr P);
void CopyReachPtrToCompPtr(ReachPtr SourcePtr, CompFReachPtr *SinkPtr);
void CompFPtrFreeMem(CompFReachPtr *P);

#endif

