use SCC code for exploration of components

This commit is contained in:
Dennis Luxen
2014-12-23 12:27:04 +01:00
parent 47f65ccba6
commit 8d8724b3e1
3 changed files with 19 additions and 12 deletions
+12 -5
View File
@@ -76,7 +76,7 @@ class TarjanSCC
bool on_stack;
};
std::vector<unsigned> components_index;
std::vector<unsigned> components_index;
std::vector<NodeID> component_size_vector;
std::shared_ptr<GraphT> m_node_based_graph;
std::unordered_set<NodeID> barrier_node_set;
@@ -84,18 +84,19 @@ class TarjanSCC
unsigned size_one_counter;
public:
template<class ContainerT>
TarjanSCC(std::shared_ptr<GraphT> graph,
const RestrictionMap &restrictions,
const std::vector<NodeID> &barrier_node_list)
const ContainerT &barrier_node_list)
: components_index(graph->GetNumberOfNodes(), SPECIAL_NODEID),
m_node_based_graph(graph), m_restriction_map(restrictions),
m_node_based_graph(graph), m_restriction_map(restrictions),
size_one_counter(0)
{
barrier_node_set.insert(std::begin(barrier_node_list), std::end(barrier_node_list));
BOOST_ASSERT(m_node_based_graph->GetNumberOfNodes() > 0);
}
void Run()
void run()
{
TIMER_START(SCC_RUN);
// The following is a hack to distinguish between stuff that happens
@@ -160,7 +161,7 @@ class TarjanSCC
// At an only_-restriction but not at the right turn
// continue;
}
if (m_restriction_map.CheckIfTurnIsRestricted(u, v, vprime))
{
// continue;
@@ -231,6 +232,12 @@ class TarjanSCC
}
std::size_t get_number_of_components() const
{
return component_size_vector.size();
}
unsigned get_component_size(const NodeID node) const
{
return component_size_vector[components_index[node]];