| 7 | |
| 8 | template <typename captype, typename tcaptype, typename flowtype> |
| 9 | Graph<captype, tcaptype, flowtype>::Graph(int node_num_max, int edge_num_max, void (*err_function)(const char *)) |
| 10 | : node_num(0), |
| 11 | nodeptr_block(NULL), |
| 12 | error_function(err_function) |
| 13 | { |
| 14 | if (node_num_max < 16) |
| 15 | node_num_max = 16; |
| 16 | if (edge_num_max < 16) |
| 17 | edge_num_max = 16; |
| 18 | |
| 19 | nodes = (node *)malloc(node_num_max * sizeof(node)); |
| 20 | arcs = (arc *)malloc(2 * edge_num_max * sizeof(arc)); |
| 21 | if (!nodes || !arcs) |
| 22 | { |
| 23 | if (error_function) |
| 24 | (*error_function)("Not enough memory!"); |
| 25 | exit(1); |
| 26 | } |
| 27 | |
| 28 | node_last = nodes; |
| 29 | node_max = nodes + node_num_max; |
| 30 | arc_last = arcs; |
| 31 | arc_max = arcs + 2 * edge_num_max; |
| 32 | |
| 33 | maxflow_iteration = 0; |
| 34 | flow = 0; |
| 35 | } |
| 36 | |
| 37 | template <typename captype, typename tcaptype, typename flowtype> |
| 38 | Graph<captype, tcaptype, flowtype>::~Graph() |
nothing calls this directly
no outgoing calls
no test coverage detected