From ba06a3a0dec8b132f3ad81c62f7ec98f95430f11 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Sun, 18 Sep 2016 20:31:20 +0000 Subject: lib: Add edge removal to graph data structure Ability to remove directed edge between two nodes. Also ensures that adjacency vectors have no null entries. Signed-off-by: Quentin Young --- lib/graph.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'lib/graph.h') diff --git a/lib/graph.h b/lib/graph.h index b6a03b938a..8d8aa3823b 100644 --- a/lib/graph.h +++ b/lib/graph.h @@ -64,6 +64,7 @@ graph_new_node (struct graph *graph, void *data, void (*del) (void*)); * If *data and *del are non-null, the following call is made: * (*node->del) (node->data); * + * @param[in] graph the graph this node belongs to * @param[out] node pointer to node to delete */ void @@ -80,8 +81,16 @@ struct graph_node * graph_add_edge (struct graph_node *from, struct graph_node *to); /** - * Deletes a graph. + * Removes a directed edge between two nodes. * + * @param[in] from + * @param[in] to + */ +void +graph_remove_edge (struct graph_node *from, struct graph_node *to); + +/** + * Deletes a graph. * Calls graph_delete_node on each node before freeing the graph struct itself. * * @param graph the graph to delete -- cgit v1.2.3