rename variables in SCC class, add const to variables, reformat
This commit is contained in:
parent
1540e6518c
commit
3db50fdd54
@ -57,7 +57,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
#include <limits>
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <stack>
|
#include <stack>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
@ -69,11 +68,7 @@ class TarjanSCC
|
|||||||
private:
|
private:
|
||||||
struct TarjanNode
|
struct TarjanNode
|
||||||
{
|
{
|
||||||
TarjanNode()
|
TarjanNode() : index(SPECIAL_NODEID), low_link(SPECIAL_NODEID), on_stack(false) {}
|
||||||
: index(std::numeric_limits<unsigned>::max()),
|
|
||||||
low_link(std::numeric_limits<unsigned>::max()), on_stack(false)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
unsigned index;
|
unsigned index;
|
||||||
unsigned low_link;
|
unsigned low_link;
|
||||||
bool on_stack;
|
bool on_stack;
|
||||||
@ -82,13 +77,7 @@ class TarjanSCC
|
|||||||
struct TarjanEdgeData
|
struct TarjanEdgeData
|
||||||
{
|
{
|
||||||
TarjanEdgeData() : distance(INVALID_EDGE_WEIGHT), name_id(INVALID_NAMEID) {}
|
TarjanEdgeData() : distance(INVALID_EDGE_WEIGHT), name_id(INVALID_NAMEID) {}
|
||||||
TarjanEdgeData(int distance, unsigned name_id) //, bool shortcut, short type, bool forward,
|
TarjanEdgeData(int distance, unsigned name_id) : distance(distance), name_id(name_id) {}
|
||||||
// bool backward, bool reversedEdge) :
|
|
||||||
: distance(distance),
|
|
||||||
name_id(name_id) //, shortcut(shortcut), type(type), forward(forward),
|
|
||||||
// backward(backward), reversedEdge(reversedEdge)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
int distance;
|
int distance;
|
||||||
unsigned name_id;
|
unsigned name_id;
|
||||||
};
|
};
|
||||||
@ -250,7 +239,7 @@ class TarjanSCC
|
|||||||
{
|
{
|
||||||
const bool before_recursion = recursion_stack.top().first;
|
const bool before_recursion = recursion_stack.top().first;
|
||||||
TarjanStackFrame currentFrame = recursion_stack.top().second;
|
TarjanStackFrame currentFrame = recursion_stack.top().second;
|
||||||
NodeID v = currentFrame.v;
|
const NodeID v = currentFrame.v;
|
||||||
recursion_stack.pop();
|
recursion_stack.pop();
|
||||||
|
|
||||||
if (before_recursion)
|
if (before_recursion)
|
||||||
@ -266,11 +255,11 @@ class TarjanSCC
|
|||||||
++index;
|
++index;
|
||||||
|
|
||||||
// Traverse outgoing edges
|
// Traverse outgoing edges
|
||||||
for (const auto e2 : m_node_based_graph->GetAdjacentEdgeRange(v))
|
for (const auto current_edge : m_node_based_graph->GetAdjacentEdgeRange(v))
|
||||||
{
|
{
|
||||||
const TarjanDynamicGraph::NodeIterator vprime =
|
const TarjanDynamicGraph::NodeIterator vprime =
|
||||||
m_node_based_graph->GetTarget(e2);
|
m_node_based_graph->GetTarget(current_edge);
|
||||||
if (std::numeric_limits<unsigned>::max() == tarjan_node_list[vprime].index)
|
if (SPECIAL_NODEID == tarjan_node_list[vprime].index)
|
||||||
{
|
{
|
||||||
recursion_stack.emplace(true, TarjanStackFrame(vprime, v));
|
recursion_stack.emplace(true, TarjanStackFrame(vprime, v));
|
||||||
}
|
}
|
||||||
@ -390,7 +379,7 @@ class TarjanSCC
|
|||||||
components_index.clear();
|
components_index.clear();
|
||||||
components_index.shrink_to_fit();
|
components_index.shrink_to_fit();
|
||||||
BOOST_ASSERT_MSG(0 == components_index.size() && 0 == components_index.capacity(),
|
BOOST_ASSERT_MSG(0 == components_index.size() && 0 == components_index.capacity(),
|
||||||
"icomponents_index not properly deallocated");
|
"components_index not properly deallocated");
|
||||||
|
|
||||||
SimpleLogger().Write() << "total network distance: "
|
SimpleLogger().Write() << "total network distance: "
|
||||||
<< (uint64_t)total_network_distance / 100 / 1000. << " km";
|
<< (uint64_t)total_network_distance / 100 / 1000. << " km";
|
||||||
@ -412,7 +401,7 @@ class TarjanSCC
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return std::numeric_limits<unsigned>::max();
|
return SPECIAL_NODEID;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CheckIfTurnIsRestricted(const NodeID u, const NodeID v, const NodeID w) const
|
bool CheckIfTurnIsRestricted(const NodeID u, const NodeID v, const NodeID w) const
|
||||||
|
Loading…
Reference in New Issue
Block a user