36#ifndef __YTLIB_GRAPH_H 
   37#define __YTLIB_GRAPH_H 
   39#include "lang/ytObject.h" 
   62  void (* setOrder)(
ytGraph * g, 
int order);
 
   65  int (* numNodes)(
const ytGraph * g);
 
   66  int (* numEdges)(
const ytGraph * g);
 
   67  int (* checkEdge)(
const ytGraph * g, 
int u, 
int v);
 
   68  int (* degree)(
const ytGraph * g, 
int u);
 
   69  int (* numParents)(
const ytGraph * g, 
int u);
 
   70  int (* numChildren)(
const ytGraph * g, 
int u);
 
   71  void (* addEdge)(
ytGraph * g, 
int u, 
int v);
 
   73  const int * (* getParents)(
const ytGraph * g, 
int u);
 
   74  const int * (* getChildren)(
const ytGraph *g, 
int u);
 
   75  void (* removeEdge)(
ytGraph * g, 
int u, 
int v);
 
   78  void (* print)(
const ytGraph * g, FILE * fp);
 
   84  void (* MPI_Bcast)(
ytObject ** pg, 
int root, MPI_Comm comm);
 
 
   88#define ytGraph_setOrder(g,n) g->setOrder(g,n) 
   89#define ytGraph_delete(g) g->delete(g) 
   90#define ytGraph_clone(g) g->clone(g) 
   91#define ytGraph_degree(g,u) g->degree(g,u) 
   92#define ytGraph_addEdge(g,u,v) g->addEdge(g,u,v) 
   93#define ytGraph_clear(g) g->clear(g) 
  151void ytGraph_print(
const ytGraph * g, FILE * fp);
 
  166#define ytGraph_numNodes(g) g->numNodes(g) 
  167#define ytGraph_numEdges(g) g->numEdges(g) 
  168#define ytGraph_checkEdge(g,u,v) g->checkEdge(g,u,v) 
  169#define ytGraph_getParents(g,u) g->getParents(g,u) 
  170#define ytGraph_numParents(g,u) g->numParents(g,u) 
  171#define ytGraph_getChildren(g,u) g->getChildren(g,u) 
  172#define ytGraph_numChildren(g,u) g->numChildren(g,u) 
  173#define ytGraph_removeEdge(g,u,v) g->removeEdge(g,u,v) 
  174#define ytGraph_print(g,fp) g->print(g,fp) 
  175#define ytGraph_edgeIter(g) g->edgeIter(g) 
  176#define ytGraph_edgeIterNext(g,i) g->edgeIterNext(g,i) 
  178#define ytGraph_MPI_Bcast(pg,r,c) (*pg)->MPI_Bcast(pg,r,c) 
  182size_t ytGraph_size(
const ytGraph * 
this);
 
  183ytByte * ytGraph_serialize(
const ytGraph * 
this, ytByte ** pptr);
 
  184ytByte * ytGraph_serializeI(
const ytObject * obj, ytByte ** pptr);
 
  185ytGraph * 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.