Graph Start

This commit is contained in:
2026-09-05 13:36:43 +08:00
parent 4e5ae52e54
commit 1564716731
9 changed files with 844 additions and 0 deletions
+48
View File
@@ -0,0 +1,48 @@
#ifndef INCLUDED_C_ADJLIST_H
#define INCLUDED_C_ADJLIST_H
#ifndef INCLUDED_C_TYPES_H
#include <c_Types.h>
#endif /*INCLUDED_C_TYPES_H*/
#ifndef INCLUDED_C_ALLOCATOR_H
#include <c_Allocator.h>
#endif /*INCLUDED_C_ALLOCATOR_H*/
/* ------------------------------------------------------------------------------------------------------------------ */
/* */
typedef struct {
c_uint_t* array;
c_size_t capacity;
c_size_t size;
c_Allocator_t allocator;
}c_AdjList_t;
/* ------------------------------------------------------------------------------------------------------------------ */
/* */
c_err_t c_AdjList_Init(c_AdjList_t* self, c_size_t capacity, c_Allocator_t* allocator);
void c_AdjList_Destroy(c_AdjList_t* self);
c_err_t c_AdjList_Resize(c_AdjList_t* self, c_size_t new_capacity);
c_err_t c_AdjList_Append(c_AdjList_t* self, c_uint_t value);
c_err_t c_AdjList_Set(c_AdjList_t* self, c_size_t index, c_uint_t value);
c_err_t c_AdjList_Get(c_AdjList_t* self, c_size_t index, c_uint_t* value);
c_err_t c_AdjList_Remove(c_AdjList_t* self, c_size_t index);
C_STATIC_FORCE_INLINE
c_bool_t c_AdjList_IsEmpty(c_AdjList_t* self) {
if (!self) return C_TRUE;
return self->size==0;
}
#endif /*INCLUDED_C_ADJLIST_H*/