forked from alicevision/AliceVision
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMaxFlow_AdjList.cpp
More file actions
72 lines (59 loc) · 2.21 KB
/
MaxFlow_AdjList.cpp
File metadata and controls
72 lines (59 loc) · 2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// This file is part of the AliceVision project.
// Copyright (c) 2017 AliceVision contributors.
// This Source Code Form is subject to the terms of the Mozilla Public License,
// v. 2.0. If a copy of the MPL was not distributed with this file,
// You can obtain one at https://mozilla.org/MPL/2.0/.
#include "MaxFlow_AdjList.hpp"
namespace aliceVision {
namespace fuseCut {
void MaxFlow_AdjList::printStats() const
{
ALICEVISION_LOG_INFO("# vertices: " << _graph.m_vertices.size() << ", capacity: " << _graph.m_vertices.capacity());
// std::cout << "nb edges: " << _graph.m_edges.size() << ", capacity: " << _graph.m_edges.capacity() << std::endl;
VertexIterator vi, vi_end;
std::map<std::size_t, int> histSize;
std::map<std::size_t, int> histCapacity;
for(boost::tie(vi, vi_end) = vertices(_graph); vi != vi_end; ++vi)
{
std::size_t s = _graph.m_vertices[*vi].m_out_edges.size();
std::size_t c = _graph.m_vertices[*vi].m_out_edges.capacity();
if(histSize.find(s) == histSize.end())
histSize[s] = 1;
else
++histSize[s];
if(histCapacity.find(c) == histCapacity.end())
histCapacity[c] = 1;
else
++histCapacity[c];
}
// std::cout << "edges: size=" << _graph.m_edges.size() << ", capacity=" << _graph.m_edges.capacity() << std::endl;
for(const auto& it: histSize)
{
ALICEVISION_LOG_INFO("\t- size[" << it.first << "]: " << it.second);
}
for(const auto& it: histCapacity)
{
ALICEVISION_LOG_INFO("\t- capacity[" << it.first << "]: " << it.second);
}
}
void MaxFlow_AdjList::printColorStats() const
{
std::map<int, int> histColor;
for(const auto& color: _color)
{
const int c = (int)color;
if(histColor.find(c) == histColor.end())
histColor[c] = 1;
else
++histColor[c];
}
ALICEVISION_LOG_INFO("Full (white):" << int(boost::white_color));
ALICEVISION_LOG_INFO("Empty (black):" << int(boost::black_color));
ALICEVISION_LOG_INFO("Undefined (gray):" << int(boost::gray_color));
for(const auto& it: histColor)
{
ALICEVISION_LOG_INFO("\t- color[" << it.first << "]: " << it.second);
}
}
} // namespace fuseCut
} // namespace aliceVision