This commit is contained in:
2026-09-07 18:48:16 +08:00
parent 1564716731
commit c945aa211f
138 changed files with 10337 additions and 150 deletions
+50
View File
@@ -0,0 +1,50 @@
#ifndef INCLUDED_C_EULERIANCYCLE_H
#define INCLUDED_C_EULERIANCYCLE_H
#ifndef INCLUDED_C_GRAPH_H
#include <c_Graph.h>
#endif /*INCLUDED_C_GRAPH_H*/
#ifndef INCLUDED_C_VERTEXIDLIST_H
#include <c_VertexIdList.h>
#endif /*INCLUDED_C_VERTEXIDLIST_H*/
/* ------------------------------------------------------------------------------------------------------------------ */
/* */
typedef struct {
c_VertexIdList_t cycle; // Stores the structural sequence of vertices forming the cycle
c_bool_t has_cycle; // True if an Eulerian cycle exists in the graph
c_Allocator_t allocator; // Memory allocator reference instance copy
} c_EulerianCycle_t;
/* ------------------------------------------------------------------------------------------------------------------ */
/* */
/**
* @brief Computes an Eulerian cycle in an undirected graph if one exists.
* @param self Pointer to the uninitialized Eulerian cycle tracking structure.
* @param G Pointer to the constant target graph object to analyze.
* @param allocator Memory allocator instance pointer to deploy.
* @return C_SUCCESS on success, or an error status code on allocation failure.
*/
c_err_t c_EulerianCycle_Init(c_EulerianCycle_t* self, const c_Graph_t* G, c_Allocator_t* allocator);
/**
* @brief Drops all internal allocation states within the Eulerian cycle instance safely.
*/
void c_EulerianCycle_Destroy(c_EulerianCycle_t* self);
/**
* @brief Does the graph contain an Eulerian cycle?
*/
c_bool_t c_EulerianCycle_HasCycle(const c_EulerianCycle_t* self);
/**
* @brief Returns the vertex path sequence forming the Eulerian cycle, or empty if none exists.
*/
const c_VertexIdList_t* c_EulerianCycle_Path(const c_EulerianCycle_t* self);
#endif /*INCLUDED_C_EULERIANCYCLE_H*/