#ifndef INCLUDED_C_DIRECTEDEULERIANCYCLE_H #define INCLUDED_C_DIRECTEDEULERIANCYCLE_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 cycle; /* Stores the Eulerian cycle path sequence if found */ c_Allocator_t allocator; /* Deep copy of the user-provided allocator */ } c_DirectedEulerianCycle_t; /* ------------------------------------------------------------------------------------------------------------------ */ /* */ /** * @brief Computes a directed Eulerian cycle in a digraph, if one exists. * @param allocator Explicit allocator context used to allocate internal routing arrays */ c_err_t c_DirectedEulerianCycle_Init(c_DirectedEulerianCycle_t* self, c_Digraph_t* graph, c_Allocator_t* allocator); /** * @brief Releases internal tracking buffers */ void c_DirectedEulerianCycle_Destroy(c_DirectedEulerianCycle_t* self); /** * @brief Does the digraph have a directed Eulerian cycle? */ C_STATIC_FORCE_INLINE c_bool_t c_DirectedEulerianCycle_HasCycle(c_DirectedEulerianCycle_t* self) { if (!self) return C_FALSE; return !c_VertexIdList_IsEmpty(&self->cycle); } /** * @brief Gets the vertices on the directed Eulerian cycle. * @param out_cycle An initialized c_VertexIdList_t container to collect the sequence. */ c_err_t c_DirectedEulerianCycle_GetCycle(c_DirectedEulerianCycle_t* self, c_VertexIdList_t* out_cycle); #endif /*INCLUDED_C_DIRECTEDEULERIANCYCLE_H*/