1
0
Fork 0

The C++ code should now run in O(n*m*log(n))

This commit is contained in:
Joris van Rantwijk 2024-11-17 21:19:15 +01:00
parent 105679c986
commit ab691813b3
1 changed files with 6 additions and 6 deletions

View File

@ -1862,7 +1862,7 @@ public:
* thereby increasing the number of matched edges by 1. * thereby increasing the number of matched edges by 1.
* If no such path is found, the matching must already be optimal. * If no such path is found, the matching must already be optimal.
* *
* This function takes time O(n**2). * This function takes time O((n + m) * log(n)).
* *
* @return True if the matching was successfully augmented; * @return True if the matching was successfully augmented;
* false if no further improvement is possible. * false if no further improvement is possible.
@ -1995,7 +1995,7 @@ public:
// of matched edges by 1. // of matched edges by 1.
// //
// This loop runs through at most (n/2 + 1) iterations. // This loop runs through at most (n/2 + 1) iterations.
// Each iteration takes time O(n**2). // Each iteration takes time O((n + m) * log(n)).
while (run_stage()) ; while (run_stage()) ;
// Clean up and unwind lazy updates to dual variables. // Clean up and unwind lazy updates to dual variables.
@ -2357,12 +2357,12 @@ private:
* no effect on the maximum-weight matching. * no effect on the maximum-weight matching.
* Edges with negative weight are ignored. * Edges with negative weight are ignored.
* *
* This function takes time O(n**3), where "n" is the number of vertices. * This function takes time O(n * (n + m) * log(n)),
* This function uses O(n + m) memory, where "m" is the number of edges. * where "n" is the number of vertices and "m" is the number of edges.
* This function uses O(n + m) memory.
* *
* @tparam WeightType Type used to represent edge weights. * @tparam WeightType Type used to represent edge weights.
* This must be a signed type. * This must be a signed type, e.g. "long" or "double".
* For example "long" or "double".
* *
* @param edges Graph defined as a vector of weighted edges. * @param edges Graph defined as a vector of weighted edges.
* *