MCPcopy Create free account
hub / github.com/colmap/colmap / TEST

Function TEST

src/colmap/math/spanning_tree_test.cc:53–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51}
52
53TEST(SpanningTree, Nominal) {
54 // Triangle: edges with weights 1, 2, 3.
55 // Max spanning tree uses edges 2+3=5, min uses 1+2=3.
56 const std::vector<std::pair<int, int>> edges = {{0, 1}, {1, 2}, {0, 2}};
57 const std::vector<float> weights = {1.0f, 2.0f, 3.0f};
58
59 const SpanningTree max_tree = ComputeMaximumSpanningTree(3, edges, weights);
60 const SpanningTree min_tree = ComputeMinimumSpanningTree(3, edges, weights);
61
62 EXPECT_EQ(ComputeTreeWeight(max_tree, edges, weights), 5.0f);
63 EXPECT_EQ(ComputeTreeWeight(min_tree, edges, weights), 3.0f);
64}
65
66TEST(SpanningTree, DisconnectedGraph) {
67 // Two components: {0,1} and {2,3}. Only component containing root is

Callers

nothing calls this directly

Calls 4

ComputeTreeWeightFunction · 0.85
IsValidMethod · 0.45

Tested by

no test coverage detected