From ab691813b3a4883c8f7f0223bb2f886ca8a46e64 Mon Sep 17 00:00:00 2001 From: Joris van Rantwijk Date: Sun, 17 Nov 2024 21:19:15 +0100 Subject: [PATCH] The C++ code should now run in O(n*m*log(n)) --- cpp/mwmatching.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cpp/mwmatching.h b/cpp/mwmatching.h index cad8d19..a98bc7f 100644 --- a/cpp/mwmatching.h +++ b/cpp/mwmatching.h @@ -1862,7 +1862,7 @@ public: * thereby increasing the number of matched edges by 1. * 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; * false if no further improvement is possible. @@ -1995,7 +1995,7 @@ public: // of matched edges by 1. // // 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()) ; // Clean up and unwind lazy updates to dual variables. @@ -2357,12 +2357,12 @@ private: * no effect on the maximum-weight matching. * Edges with negative weight are ignored. * - * This function takes time O(n**3), where "n" is the number of vertices. - * This function uses O(n + m) memory, where "m" is the number of edges. + * This function takes time O(n * (n + m) * log(n)), + * 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. - * This must be a signed type. - * For example "long" or "double". + * This must be a signed type, e.g. "long" or "double". * * @param edges Graph defined as a vector of weighted edges. *