Clean up code formatting
This commit is contained in:
parent
1e6f2a11c4
commit
f0773eb84b
|
@ -67,11 +67,11 @@ public:
|
|||
public:
|
||||
/** Construct an unused node, not yet contained in any queue. */
|
||||
Node()
|
||||
: owner_(nullptr),
|
||||
parent_(nullptr),
|
||||
left_child_(nullptr),
|
||||
right_child_(nullptr),
|
||||
height_(0)
|
||||
: owner_(nullptr)
|
||||
, parent_(nullptr)
|
||||
, left_child_(nullptr)
|
||||
, right_child_(nullptr)
|
||||
, height_(0)
|
||||
{ }
|
||||
|
||||
// Prevent copying.
|
||||
|
|
|
@ -52,11 +52,11 @@ struct Edge
|
|||
WeightType weight;
|
||||
|
||||
Edge(VertexPair vt, WeightType w)
|
||||
: vt(vt), weight(w)
|
||||
: vt(vt), weight(w)
|
||||
{ }
|
||||
|
||||
Edge(VertexId x, VertexId y, WeightType w)
|
||||
: vt(x, y), weight(w)
|
||||
: vt(x, y), weight(w)
|
||||
{ }
|
||||
};
|
||||
|
||||
|
@ -187,9 +187,9 @@ struct Graph
|
|||
* This function takes time O(n + m).
|
||||
*/
|
||||
explicit Graph(const std::vector<EdgeT>& edges_in)
|
||||
: edges(remove_negative_weight_edges(edges_in)),
|
||||
num_vertex(count_num_vertex(edges)),
|
||||
adjacent_edges(build_adjacent_edges(edges, num_vertex))
|
||||
: edges(remove_negative_weight_edges(edges_in))
|
||||
, num_vertex(count_num_vertex(edges))
|
||||
, adjacent_edges(build_adjacent_edges(edges, num_vertex))
|
||||
{ }
|
||||
|
||||
// Prevent copying.
|
||||
|
@ -337,13 +337,13 @@ struct Blossom
|
|||
protected:
|
||||
/** Initialize base class. */
|
||||
Blossom(VertexId base_vertex, bool is_nontrivial_blossom)
|
||||
: parent(nullptr),
|
||||
base_vertex(base_vertex),
|
||||
label(LABEL_NONE),
|
||||
is_nontrivial_blossom(is_nontrivial_blossom),
|
||||
tree_root(NO_VERTEX),
|
||||
vertex_queue(this),
|
||||
vertex_dual_offset(0)
|
||||
: parent(nullptr)
|
||||
, base_vertex(base_vertex)
|
||||
, label(LABEL_NONE)
|
||||
, is_nontrivial_blossom(is_nontrivial_blossom)
|
||||
, tree_root(NO_VERTEX)
|
||||
, vertex_queue(this)
|
||||
, vertex_dual_offset(0)
|
||||
{ }
|
||||
|
||||
public:
|
||||
|
@ -446,8 +446,8 @@ struct NonTrivialBlossom : public Blossom<WeightType>
|
|||
NonTrivialBlossom(
|
||||
const std::vector<Blossom<WeightType>*>& subblossoms,
|
||||
const std::deque<VertexPair>& edges)
|
||||
: Blossom<WeightType>(subblossoms.front()->base_vertex, true),
|
||||
dual_var(0)
|
||||
: Blossom<WeightType>(subblossoms.front()->base_vertex, true)
|
||||
, dual_var(0)
|
||||
{
|
||||
assert(subblossoms.size() == edges.size());
|
||||
assert(subblossoms.size() % 2 == 1);
|
||||
|
@ -680,12 +680,12 @@ public:
|
|||
* This function takes time O(n + m).
|
||||
*/
|
||||
explicit MatchingContext(const std::vector<EdgeT>& edges_in)
|
||||
: graph(edges_in),
|
||||
trivial_blossom(graph.num_vertex),
|
||||
vertex_queue_node(graph.num_vertex),
|
||||
vertex_sedge_queue(graph.num_vertex),
|
||||
vertex_sedge_node(edges_in.size()),
|
||||
delta3_node(edges_in.size())
|
||||
: graph(edges_in)
|
||||
, trivial_blossom(graph.num_vertex)
|
||||
, vertex_queue_node(graph.num_vertex)
|
||||
, vertex_sedge_queue(graph.num_vertex)
|
||||
, vertex_sedge_node(edges_in.size())
|
||||
, delta3_node(edges_in.size())
|
||||
{
|
||||
// Initially all vertices are unmatched.
|
||||
vertex_mate.resize(graph.num_vertex, NO_VERTEX);
|
||||
|
@ -1386,7 +1386,7 @@ public:
|
|||
/** Expand and delete the specified T-blossom. */
|
||||
void expand_t_blossom(NonTrivialBlossomT* blossom)
|
||||
{
|
||||
assert(blossom->parent == nullptr);
|
||||
assert(! blossom->parent);
|
||||
assert(blossom->label == LABEL_T);
|
||||
|
||||
// Remove label from blossom.
|
||||
|
@ -1530,12 +1530,12 @@ public:
|
|||
|
||||
// Augment through any non-trivial subblossoms touching this edge.
|
||||
NonTrivialBlossomT* bx_ntb = bx->nontrivial();
|
||||
if (bx_ntb != nullptr) {
|
||||
if (bx_ntb) {
|
||||
rec_stack.emplace(bx_ntb, &trivial_blossom[x]);
|
||||
}
|
||||
|
||||
NonTrivialBlossomT* by_ntb = by->nontrivial();
|
||||
if (by_ntb != nullptr) {
|
||||
if (by_ntb) {
|
||||
rec_stack.emplace(by_ntb, &trivial_blossom[y]);
|
||||
}
|
||||
}
|
||||
|
@ -1573,7 +1573,7 @@ public:
|
|||
std::tie(outer_blossom, inner_entry) = rec_stack.top();
|
||||
|
||||
NonTrivialBlossomT* inner_blossom = inner_entry->parent;
|
||||
assert(inner_blossom != nullptr);
|
||||
assert(inner_blossom);
|
||||
|
||||
if (inner_blossom != outer_blossom) {
|
||||
// After augmenting "inner_blossom",
|
||||
|
@ -1617,13 +1617,13 @@ public:
|
|||
// Augment any non-trivial blossoms that touch this edge.
|
||||
BlossomT* bx = top_level_blossom(x);
|
||||
NonTrivialBlossomT* bx_ntb = bx->nontrivial();
|
||||
if (bx_ntb != nullptr) {
|
||||
if (bx_ntb) {
|
||||
augment_blossom(bx_ntb, &trivial_blossom[x]);
|
||||
}
|
||||
|
||||
BlossomT* by = top_level_blossom(y);
|
||||
NonTrivialBlossomT* by_ntb = by->nontrivial();
|
||||
if (by_ntb != nullptr) {
|
||||
if (by_ntb) {
|
||||
augment_blossom(by_ntb, &trivial_blossom[y]);
|
||||
}
|
||||
|
||||
|
@ -2012,9 +2012,9 @@ class MatchingVerifier
|
|||
{
|
||||
public:
|
||||
MatchingVerifier(const MatchingContext<WeightType>& ctx)
|
||||
: ctx(ctx),
|
||||
graph(ctx.graph),
|
||||
edge_duals(ctx.graph.edges.size())
|
||||
: ctx(ctx)
|
||||
, graph(ctx.graph)
|
||||
, edge_duals(ctx.graph.edges.size())
|
||||
{ }
|
||||
|
||||
/**
|
||||
|
@ -2278,7 +2278,7 @@ private:
|
|||
// Add blossom duals to the edges contained inside the blossoms.
|
||||
// This takes total time O(n**2).
|
||||
for (const NonTrivialBlossomT& blossom : ctx.nontrivial_blossom) {
|
||||
if (blossom.parent == nullptr) {
|
||||
if (! blossom.parent) {
|
||||
if (!check_blossom(&blossom)) {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue