#ifndef INCLUDED_C_DIRECTEDEULERIANPATH_H #define INCLUDED_C_DIRECTEDEULERIANPATH_H #ifndef INCLUDED_C_DIGRAPH_H #include #endif /*INCLUDED_C_DIGRAPH_H*/ #ifndef INCLUDED_C_VERTEXIDLIST_H #include #endif /*INCLUDED_C_VERTEXIDLIST_H*/ /* ------------------------------------------------------------------------------------------------------------------ */ /* */ typedef struct { c_VertexIdList_t path; /* Stores the Eulerian path sequence if found */ c_Allocator_t allocator; /* Deep copy of the user-provided allocator */ } c_DirectedEulerianPath_t; /* ------------------------------------------------------------------------------------------------------------------ */ /* */ /** * @brief Computes a directed Eulerian path in a digraph, if one exists. * @param allocator Explicit allocator context used to allocate internal routing arrays */ c_err_t c_DirectedEulerianPath_Init(c_DirectedEulerianPath_t* self, c_Digraph_t* graph, c_Allocator_t* allocator); /** * @brief Releases internal tracking buffers */ void c_DirectedEulerianPath_Destroy(c_DirectedEulerianPath_t* self); /** * @brief Does the digraph have a directed Eulerian path? */ C_STATIC_FORCE_INLINE c_bool_t c_DirectedEulerianPath_HasPath(c_DirectedEulerianPath_t* self) { if (!self) return C_FALSE; return !c_VertexIdList_IsEmpty(&self->path); } /** * @brief Gets the vertices on the directed Eulerian path. * @param out_path An initialized c_VertexIdList_t container to collect the sequence. */ c_err_t c_DirectedEulerianPath_GetPath(c_DirectedEulerianPath_t* self, c_VertexIdList_t* out_path); #endif /*INCLUDED_C_DIRECTEDEULERIANPATH_H*/