Add graph::clear()

This commit is contained in:
Andreas Fabri 2022-06-23 16:25:21 +01:00 committed by Laurent Rineau
parent 017614c1f0
commit b45e788c0f
2 changed files with 9 additions and 2 deletions

View File

@ -520,6 +520,8 @@ public:
/* Destructor */
~Graph();
void clear();
/* Adds a node to the graph */
node_id add_node();
@ -701,7 +703,7 @@ inline Graph::Graph(void (*err_function)(const char *))
flow = 0;
}
inline Graph::~Graph()
inline void Graph::clear()
{
while (node_block_first) {
node_block *next = node_block_first -> next;
@ -722,6 +724,11 @@ inline Graph::~Graph()
}
}
inline Graph::~Graph()
{
clear();
}
inline Graph::node_id Graph::add_node()
{
node *i;

View File

@ -47,7 +47,7 @@ public:
void clear_graph()
{
graph = MaxFlow::Graph();
graph.clear();
}
Vertex_descriptor add_vertex()