Graph
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
#ifndef INCLUDED_C_GRAPHDFS_H
|
||||
#define INCLUDED_C_GRAPHDFS_H
|
||||
|
||||
#ifndef INCLUDED_C_GRAPH_H
|
||||
#include <c_Graph.h>
|
||||
#endif /*INCLUDED_C_GRAPH_H*/
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------------------------ */
|
||||
/* */
|
||||
|
||||
|
||||
/**
|
||||
* @brief User-defined callback action function executed when a vertex is discovered.
|
||||
* @param vertex_index The index of the vertex being visited.
|
||||
* @param context User-supplied optional state pointer (e.g., custom accumulation structures).
|
||||
* @return C_TRUE to continue traversing, C_FALSE to abort the entire DFS traversal early.
|
||||
*/
|
||||
typedef c_bool_t (*c_Graph_DFS_Callback)(c_size_t vertex_index, void* context);
|
||||
|
||||
/**
|
||||
* @brief Performs a Depth-First Search starting from a designated source vertex.
|
||||
* @param self Pointer to the constant graph container instance.
|
||||
* @param src_vertex The index of the root vertex to start the search from.
|
||||
* @param callback Function handler to execute on every discovered node.
|
||||
* @param context Optional custom state pointer forwarded directly to the callback handler.
|
||||
* @param allocator allocator for DFS
|
||||
* @return C_SUCCESS on successful traversal, or an error status code on failure.
|
||||
*/
|
||||
c_err_t c_Graph_DFS(const c_Graph_t* self, c_size_t src_vertex, c_Graph_DFS_Callback callback, void* context, c_Allocator_t* allocator);
|
||||
|
||||
|
||||
#endif /*INCLUDED_C_GRAPHDFS_H*/
|
||||
Reference in New Issue
Block a user