#include <graph_segmentor.h>
◆ GraphSegmentor()
| apollo::perception::algorithm::GraphSegmentor::GraphSegmentor |
( |
| ) |
|
|
default |
◆ ~GraphSegmentor()
| apollo::perception::algorithm::GraphSegmentor::~GraphSegmentor |
( |
| ) |
|
|
default |
◆ Init()
| void apollo::perception::algorithm::GraphSegmentor::Init |
( |
const float |
initial_threshold | ) |
|
在文件 graph_segmentor.cc 第 33 行定义.
33 {
34 initial_threshold_ = initial_threshold;
35 thresholds_.reserve(kMaxVerticesNum);
36
37 thresholds_table_.resize(kMaxThresholdsNum);
38 thresholds_table_[0] = std::numeric_limits<float>::max();
39 for (size_t i = 1; i < kMaxThresholdsNum; ++i) {
40 thresholds_table_[i] = GetThreshold(i, initial_threshold_);
41 }
42}
◆ mutable_universe()
| Universe * apollo::perception::algorithm::GraphSegmentor::mutable_universe |
( |
| ) |
|
|
inline |
◆ SegmentGraph()
| void apollo::perception::algorithm::GraphSegmentor::SegmentGraph |
( |
const int |
num_vertices, |
|
|
const int |
num_edges, |
|
|
Edge * |
edges, |
|
|
bool |
need_sort = true |
|
) |
| |
在文件 graph_segmentor.cc 第 44 行定义.
45 {
46 if (edges == nullptr) {
47 AERROR <<
"Input Null Edges.";
48 return;
49 }
50
51 if (need_sort) {
52 std::sort(edges, edges + num_edges);
53 }
54
55 universe_.
Reset(num_vertices);
56
57 thresholds_.assign(num_vertices, initial_threshold_);
58 for (int i = 0; i < num_edges; ++i) {
59 Edge& edge = edges[i];
60 int a = universe_.
Find(edge.a);
61 int b = universe_.
Find(edge.b);
62 if (a == b) {
63 continue;
64 }
65 if (edge.w <= thresholds_[a] && edge.w <= thresholds_[b]) {
67 a = universe_.
Find(a);
68 int size_a = universe_.
GetSize(a);
69 thresholds_[a] =
70 edge.w + (size_a < static_cast<int>(kMaxThresholdsNum)
71 ? thresholds_table_[size_a]
72 : GetThreshold(size_a, initial_threshold_));
73 }
74 }
75}
void Join(const int x, const int y)
void Reset(const int elements_num)
int GetSize(const int x) const
◆ universe()
| const Universe & apollo::perception::algorithm::GraphSegmentor::universe |
( |
| ) |
|
|
inline |
该类的文档由以下文件生成: