From dc17abb41b140cc67a1dcb978ff3a032bbfb2f33 Mon Sep 17 00:00:00 2001 From: WrinklyNinja Date: Mon, 17 Feb 2014 22:42:01 +0000 Subject: [PATCH] Work on issue #112. If two conflicting records had the same number of override form IDs, their order was dependent on the order in which they were in the graph, which is undefined, so I added a lexicographical comparison to resolve that. Testers reported that it didn't fix the issue though. --- src/backend/graph.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/backend/graph.cpp b/src/backend/graph.cpp index c847fa76..f5e56afe 100644 --- a/src/backend/graph.cpp +++ b/src/backend/graph.cpp @@ -224,10 +224,19 @@ namespace boss { continue; vertex_t vertex, parentVertex; - if (graph[*vit].NumOverrideFormIDs() >= graph[*vit2].NumOverrideFormIDs()) { + if (graph[*vit].NumOverrideFormIDs() > graph[*vit2].NumOverrideFormIDs()) { parentVertex = *vit; vertex = *vit2; - } else { + } + else if (graph[*vit].NumOverrideFormIDs() < graph[*vit2].NumOverrideFormIDs()) { + parentVertex = *vit2; + vertex = *vit; + } + else if (graph[*vit].Name() < graph[*vit2].Name()) { //There needs to be an edge between the two, but direction cannot be decided using overlap size. Just use names. + parentVertex = *vit; + vertex = *vit2; + } + else { parentVertex = *vit2; vertex = *vit; }