#ifndef INCLUDED_C_GRAPH_H #define INCLUDED_C_GRAPH_H #ifndef INCLUDED_C_ADJLIST_H #include #endif /*INCLUDED_C_ADJLIST_H*/ /* ------------------------------------------------------------------------------------------------------------------ */ /* */ typedef c_uint_t c_VertexId_t; typedef struct { c_size_t V; c_size_t E; c_AdjList_t* adj_list; c_Allocator_t allocator; }c_Graph_t; /* ------------------------------------------------------------------------------------------------------------------ */ /* */ c_err_t c_Graph_Init(c_Graph_t* self, c_size_t V, c_Allocator_t* allocator); void c_Graph_Destroy(c_Graph_t* self); c_err_t c_Graph_AddEdge(c_Graph_t* self, c_VertexId_t v, c_VertexId_t w); c_err_t c_Graph_RemoveEdge(c_Graph_t* self, c_VertexId_t v, c_VertexId_t w); c_bool_t c_Graph_HasEdge(const c_Graph_t* self, c_VertexId_t v, c_VertexId_t w); c_size_t c_Graph_Degree(c_Graph_t* self, c_VertexId_t v); c_AdjList_t* c_Graph_GetAdjList(c_Graph_t* self, c_VertexId_t v); /** * @brief Creates a complete deep copy of a source graph. * @param dst Pointer to the target destination graph structure to initialize. * @param src Pointer to the constant source graph to replicate. * @param allocator Pointer to the allocator to be used by the new cloned graph. * @return C_SUCCESS on success, or an error code (e.g., C_ERR_NOMEM, C_ERR_PARAM). */ c_err_t c_Graph_Copy(c_Graph_t* dst, const c_Graph_t* src, c_Allocator_t* allocator); #endif /*INCLUDED_C_GRAPH_H*/