From b2637b9a4338ed25c7fff14cf230f2287f499d4d Mon Sep 17 00:00:00 2001 From: Dennis Luxen Date: Tue, 23 Dec 2014 15:26:06 +0100 Subject: [PATCH] compute component id for each SCC --- contractor/edge_based_graph_factory.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/contractor/edge_based_graph_factory.cpp b/contractor/edge_based_graph_factory.cpp index b66813862..0d1e0901c 100644 --- a/contractor/edge_based_graph_factory.cpp +++ b/contractor/edge_based_graph_factory.cpp @@ -510,14 +510,23 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedNodes() const unsigned size_of_component = std::min(component_explorer.get_component_size(u), component_explorer.get_component_size(v)); + const unsigned id_of_smaller_component = [u,v,component_explorer] { + if (component_explorer.get_component_size(u) < component_explorer.get_component_size(v)) + { + return component_explorer.get_component_id(u); + } + return component_explorer.get_component_id(v); + }(); + const bool component_is_tiny = (size_of_component < 1000); + if (edge_data.edgeBasedNodeID == SPECIAL_NODEID) { - InsertEdgeBasedNode(v, u, component_is_tiny); + InsertEdgeBasedNode(v, u, (component_is_tiny ? id_of_smaller_component + 1 : 0)); } else { - InsertEdgeBasedNode(u, v, component_is_tiny); + InsertEdgeBasedNode(u, v, (component_is_tiny ? id_of_smaller_component + 1 : 0)); } } }