00001 00023 #ifndef _LIBPACKMAN_GRAPH_H_ 00024 #define _LIBPACKMAN_GRAPH_H_ 00025 00026 typedef struct _PmEdge PmEdge; 00027 typedef struct _PmVertice PmVertice; 00037 struct _PmEdge 00038 { 00039 PmVertice *target; 00041 PmEdge *prev; 00042 PmEdge *next; 00043 }; 00044 00053 struct _PmVertice 00054 { 00055 void *data; 00057 size_t edgeCount; 00059 char visited; 00061 PmEdge *edges; 00062 PmEdge *lastEdge; 00064 PmVertice *prev; 00065 PmVertice *next; 00066 }; 00067 00074 typedef struct 00075 { 00076 size_t verticeCount; 00078 PmVertice *vertices; 00079 PmVertice *lastVertice; 00081 } PmGraph; 00082 00090 PmGraph *pmNewGraph(void); 00091 00101 void pmDestroyGraph(PmGraph *graph); 00102 00112 PmVertice *pmNewVertice(void *data); 00113 00123 void pmDestroyVertice(PmVertice *vertice); 00124 00134 PmEdge *pmNewEdge(PmVertice *target); 00135 00143 void pmDestroyEdge(PmEdge *edge); 00144 00157 PmVertice *pmAddVertice(PmGraph *graph, void *data); 00158 00171 PmEdge *pmAddEdge(PmVertice *parent, PmVertice *target); 00172 00184 PmGraph *pmBuildDepGraph(PmBatch *batch); 00185 00194 void pmTSortPackages(PmGraph *graph, PmBatch *batch); 00195 00196 #endif /* _LIBPACKMAN_GRAPH_H_ */