From 6965fa1e250eaacd962b64171f98314c8e4f8ca4 Mon Sep 17 00:00:00 2001 From: wjf-hs Date: Fri, 25 Apr 2025 14:07:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0edge=E7=9A=84=E6=96=B0?= =?UTF-8?q?=E5=BB=BA=E5=92=8C=E9=87=8A=E6=94=BE=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/graph.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/graph.c b/src/graph.c index a7656ea..802f245 100644 --- a/src/graph.c +++ b/src/graph.c @@ -359,6 +359,28 @@ static void greph_node_free(struct _graph_node** node) } } +static struct _graph_edge* graph_edge_new(void *obj, uint32_t obj_size) +{ + struct _graph_edge* new_edge = (struct _graph_edge*)malloc(sizeof(struct _graph_edge)); + if (new_edge == NULL) + { + return NULL; + } + new_edge->next = NULL; + new_edge->weight = 0; + new_edge->target = NULL; + return new_edge; +} + +static void greph_edge_free(struct _graph_edge** edge) +{ + if(edge != NULL && *edge != NULL) + { + free(*edge); + *edge = NULL; + } +} + static uint32_t graph_size(struct _graph* self) { if(self == NULL)