Graph Start
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
#ifndef INCLUDED_C_GRAPH_H
|
||||
#define INCLUDED_C_GRAPH_H
|
||||
|
||||
#ifndef INCLUDED_C_ADJLIST_H
|
||||
#include <c_AdjList.h>
|
||||
#endif /*INCLUDED_C_ADJLIST_H*/
|
||||
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------------------------ */
|
||||
/* */
|
||||
|
||||
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_size_t v, c_size_t w);
|
||||
|
||||
c_err_t c_Graph_RemoveEdge(c_Graph_t* self, c_size_t v, c_size_t w);
|
||||
|
||||
c_bool_t c_Graph_HasEdge(const c_Graph_t* self, c_size_t v, c_size_t w);
|
||||
|
||||
c_size_t c_Graph_Degree(c_Graph_t* self, c_size_t v);
|
||||
|
||||
c_AdjList_t* c_Graph_GetAdjList(c_Graph_t* self, c_size_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*/
|
||||
Reference in New Issue
Block a user