Files
cKit/Context/c_FlowNetwork.h
T

40 lines
1.4 KiB
C
Raw Normal View History

2026-09-07 19:33:37 +08:00
#ifndef INCLUDED_C_FLOWNETWORK_H
#define INCLUDED_C_FLOWNETWORK_H
#ifndef INCLUDED_C_FLOWEDGE_H
#include <c_FlowEdge.h>
#endif /*INCLUDED_C_FLOWEDGE_H*/
#ifndef INCLUDED_C_UINTARRAY_H
#include <c_UIntArray.h>
#endif /*INCLUDED_C_UINTARRAY_H*/
#ifndef INCLUDED_C_ALLOCATOR_H
#include <c_Allocator.h>
#endif /*INCLUDED_C_ALLOCATOR_H*/
/* ------------------------------------------------------------------------------------------------------------------ */
/* */
typedef struct {
c_size_t V; /* Total number of vertices */
c_size_t E; /* Total number of directed flow edges (including residual twins) */
c_UIntArray_t* adj_list; /* Array of lists storing global edge_ids exiting/entering each vertex */
c_FlowEdge_t* edges_pool; /* Global contiguous array pool housing raw flow edge objects */
c_size_t edges_cap; /* Allocated edge pool tracking capacity boundary */
c_Allocator_t allocator; /* Embedded custom allocator structure instance */
} c_FlowNetwork_t;
/* ------------------------------------------------------------------------------------------------------------------ */
/* */
c_err_t c_FlowNetwork_Init(c_FlowNetwork_t* self, c_size_t V, c_Allocator_t* alloc);
void c_FlowNetwork_Destroy(c_FlowNetwork_t* self);
c_err_t c_FlowNetwork_AddEdge(c_FlowNetwork_t* self, c_size_t from, c_size_t to, double capacity);
#endif /*INCLUDED_C_FLOWNETWORK_H*/