10#define __YTLIB_GRAPH_H 
   12#include "lang/ytObject.h" 
   35  void (* setOrder)(
ytGraph * g, 
int order);
 
   38  int (* numNodes)(
const ytGraph * g);
 
   39  int (* numEdges)(
const ytGraph * g);
 
   40  int (* checkEdge)(
const ytGraph * g, 
int u, 
int v);
 
   41  int (* degree)(
const ytGraph * g, 
int u);
 
   42  int (* numParents)(
const ytGraph * g, 
int u);
 
   43  int (* numChildren)(
const ytGraph * g, 
int u);
 
   44  void (* addEdge)(
ytGraph * g, 
int u, 
int v);
 
   46  const int * (* getParents)(
const ytGraph * g, 
int u);
 
   47  const int * (* getChildren)(
const ytGraph *g, 
int u);
 
   48  void (* removeEdge)(
ytGraph * g, 
int u, 
int v);
 
   51  void (* print)(
const ytGraph * g, FILE * fp);
 
   57  void (* MPI_Bcast)(
ytObject ** pg, 
int root, MPI_Comm comm);
 
 
   61#define ytGraph_setOrder(g,n) g->setOrder(g,n) 
   62#define ytGraph_delete(g) g->delete(g) 
   63#define ytGraph_clone(g) g->clone(g) 
   64#define ytGraph_degree(g,u) g->degree(g,u) 
   65#define ytGraph_addEdge(g,u,v) g->addEdge(g,u,v) 
   66#define ytGraph_clear(g) g->clear(g) 
  124void ytGraph_print(
const ytGraph * g, FILE * fp);
 
  139#define ytGraph_numNodes(g) g->numNodes(g) 
  140#define ytGraph_numEdges(g) g->numEdges(g) 
  141#define ytGraph_checkEdge(g,u,v) g->checkEdge(g,u,v) 
  142#define ytGraph_getParents(g,u) g->getParents(g,u) 
  143#define ytGraph_numParents(g,u) g->numParents(g,u) 
  144#define ytGraph_getChildren(g,u) g->getChildren(g,u) 
  145#define ytGraph_numChildren(g,u) g->numChildren(g,u) 
  146#define ytGraph_removeEdge(g,u,v) g->removeEdge(g,u,v) 
  147#define ytGraph_print(g,fp) g->print(g,fp) 
  148#define ytGraph_edgeIter(g) g->edgeIter(g) 
  149#define ytGraph_edgeIterNext(g,i) g->edgeIterNext(g,i) 
  151#define ytGraph_MPI_Bcast(pg,r,c) (*pg)->MPI_Bcast(pg,r,c) 
  155size_t ytGraph_size(
const ytGraph * 
this);
 
  156ytByte * ytGraph_serialize(
const ytGraph * 
this, ytByte ** pptr);
 
  157ytByte * ytGraph_serializeI(
const ytObject * obj, ytByte ** pptr);
 
  158ytGraph * ytGraph_deserialize(ytByte ** 
const pptr);
 
Interface class for handling graph structure.
int ytGraph_checkEdge(const ytGraph *g, int u, int v)
Checks if the specified edge exists.
int ytGraph_numNodes(const ytGraph *g)
Returns the number of nodes in the graph.
void ytGraph_edgeIterNext(const ytGraph *g, ytGraphEdgeIter *i)
Obtains the next edge.
void ytGraph_removeEdge(ytGraph *g, int u, int v)
Removes the specified edge.
int ytGraph_numChildren(const ytGraph *g, int u)
Returns the number of children.
int ytGraph_numParents(const ytGraph *g, int u)
Return the number of parents for the specified node.
const int * ytGraph_getChildren(const ytGraph *g, int u)
Returns the integer array that contains the indices of children.
int ytGraph_numEdges(const ytGraph *g)
Returns the number of edges in the graph.
ytGraphEdgeIter * ytGraph_edgeIter(const ytGrpah *g)
Returns the ytGraphEdgeIter instance representing the first edge.
void ytGraph_MPI_Bcast(ytObject **pg, int root, MPI_Comm comm)
[MPI] Broadcasts the graph to all the processes.
const int * ytGraph_getParents(const ytGraph *g, int u)
Returns the integer array that contains the indices of parents of the specifiec node.