Graph
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
#ifndef INCLUDED_C_DEPTHFIRSTORDER_H
|
||||
#define INCLUDED_C_DEPTHFIRSTORDER_H
|
||||
|
||||
#ifndef INCLUDED_C_DIGRAPH_H
|
||||
#include <c_Digraph.h>
|
||||
#endif /*INCLUDED_C_DIGRAPH_H*/
|
||||
|
||||
|
||||
#ifndef INCLUDED_C_VERTEXIDLIST_H
|
||||
#include <c_VertexIdList.h>
|
||||
#endif /*INCLUDED_C_VERTEXIDLIST_H*/
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------------------------ */
|
||||
/* */
|
||||
|
||||
typedef struct {
|
||||
c_bool_t* marked; /* Visited tracking array (size of graph->V) */
|
||||
c_VertexIdList_t pre_order; /* Vertices in pre-order sequence */
|
||||
c_VertexIdList_t post_order; /* Vertices in post-order sequence */
|
||||
c_VertexIdList_t reverse_post; /* Vertices in reverse post-order sequence */
|
||||
c_Allocator_t allocator; /* Deep copy of the user-provided allocator */
|
||||
} c_DepthFirstOrder_t;
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------------------------ */
|
||||
/* */
|
||||
|
||||
/**
|
||||
* @brief Computes pre-order, post-order, and reverse post-order traversals for a digraph.
|
||||
* @param allocator Explicit allocator context used to allocate internal arrays and lists
|
||||
*/
|
||||
c_err_t c_DepthFirstOrder_Init(c_DepthFirstOrder_t* self, c_Digraph_t* graph, c_Allocator_t* allocator);
|
||||
|
||||
/**
|
||||
* @brief Releases internal tracking buffers
|
||||
*/
|
||||
void c_DepthFirstOrder_Destroy(c_DepthFirstOrder_t* self);
|
||||
|
||||
/**
|
||||
* @brief Gets a copy of the pre-order vertex list.
|
||||
*/
|
||||
c_err_t c_DepthFirstOrder_GetPre(c_DepthFirstOrder_t* self, c_VertexIdList_t* out_list);
|
||||
|
||||
/**
|
||||
* @brief Gets a copy of the post-order vertex list.
|
||||
*/
|
||||
c_err_t c_DepthFirstOrder_GetPost(c_DepthFirstOrder_t* self, c_VertexIdList_t* out_list);
|
||||
|
||||
/**
|
||||
* @brief Gets a copy of the reverse post-order vertex list (Topological order candidate).
|
||||
*/
|
||||
c_err_t c_DepthFirstOrder_GetReversePost(c_DepthFirstOrder_t* self, c_VertexIdList_t* out_list);
|
||||
|
||||
|
||||
#endif /*INCLUDED_C_DEPTHFIRSTORDER_H*/
|
||||
Reference in New Issue
Block a user