diff --git a/mt-kahypar/dynamic/dynamic_io.h b/mt-kahypar/dynamic/dynamic_io.h index 51600197f..4919d188f 100644 --- a/mt-kahypar/dynamic/dynamic_io.h +++ b/mt-kahypar/dynamic/dynamic_io.h @@ -310,7 +310,7 @@ namespace mt_kahypar::dyn { void generateErrorFile(Context& context, DynamicStrategy* strategy, std::exception& e) { std::string filename = context.dynamic.output_path; - std::ofstream file(filename); + std::ofstream file(filename + ".error"); if (!file.is_open()) { throw std::runtime_error("Could not open file: " + filename); } diff --git a/mt-kahypar/dynamic/dynamic_partitioner.h b/mt-kahypar/dynamic/dynamic_partitioner.h index d11402bc4..f35ee1c32 100644 --- a/mt-kahypar/dynamic/dynamic_partitioner.h +++ b/mt-kahypar/dynamic/dynamic_partitioner.h @@ -14,7 +14,8 @@ namespace mt_kahypar::dyn { ds::StaticHypergraph& hypergraph_s = utils::cast(hypergraph); - if (context.dynamic.max_changes == -1) context.dynamic.max_changes = changes.size(); + // If the number of changes is not specified or is greater than the number of changes in the file, we process all the changes + size_t changes_size = context.dynamic.max_changes == -1 ? changes.size() : std::min((size_t) context.dynamic.max_changes, changes.size()); DynamicStrategy* strategy; @@ -36,7 +37,7 @@ namespace mt_kahypar::dyn { std::cout << "Processing " << context.dynamic.max_changes << " changes" << std::endl; - for (size_t i = 0; i < context.dynamic.max_changes; ++i) { + for (size_t i = 0; i < changes_size; ++i) { Change& change = changes[i]; strategy->partition(hypergraph_s, context, change); if (!context.dynamic.server && *(&strategy->history.back().valid)) {