graph.c revision 3f54fd611f536639ec30dd53c48e5ec1897cc7d9
#include "grhdr.h"
/******************************************************************************
This defines a collection of basic operations on directed graphs.
Written by Kiem-Phong Vo (02/01/2006).
******************************************************************************/
/* CDT discipline for nodeset */
{
else return 0;
}
{
if(node)
}
}
}
/* CDT discipline for edgeset */
{
else return 0;
}
{
if(edge)
}
}
}
{
if(!gr)
/* see if the node already exists */
if(type < 0) /* deleting a node */
{ if(nd)
{ enext = e;
}
{ enext = e;
}
}
}
return nd;
/* making a new node */
}
{
/* see if the edge exists */
if(type < 0) /* deleting */
{ if(ed)
{ if(e == ed)
{ if(pe)
break;
}
}
{ if(e == ed)
{ if(pe)
break;
}
}
}
}
return ed;
}
{
break;
else if(dt)
/* put this at front of list for fast future accesses */
return dt;
}
/* restore a graph after manipulation of nodes and edges */
{
}
}
return 0;
}
{
if(!gr)
return -1;
return -1;
}
return 0;
}
{
}
}
return gr;
}