Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deduplicate segments with the same tangent properly on mcf_graph::slope #37

Closed
MiSawa opened this issue Sep 13, 2020 · 1 comment · Fixed by #38
Closed

Deduplicate segments with the same tangent properly on mcf_graph::slope #37

MiSawa opened this issue Sep 13, 2020 · 1 comment · Fixed by #38

Comments

@MiSawa
Copy link
Contributor

MiSawa commented Sep 13, 2020

This line doesn't seem to be correct me. Instead, we should update this variable by d.
Also, it would be better to name it cost_per_flow or something like that to avoid confusion.

prev_cost = cost;

A test case would be

TEST(MincostflowTest, SameCostPaths) {
    mcf_graph<int, int> g(3);
    ASSERT_EQ(0, g.add_edge(0, 1, 1, 1));
    ASSERT_EQ(1, g.add_edge(1, 2, 1, 0));
    ASSERT_EQ(2, g.add_edge(0, 2, 2, 1));
    auto expected = std::vector<std::pair<int, int>>{{0, 0}, {3, 3}};
    ASSERT_EQ(expected, g.slope(0, 2));
}
@yosupo06
Copy link
Collaborator

Thanks! Yes, this is a bug clearly.

yosupo06 added a commit that referenced this issue Sep 13, 2020
fix #37: Fix deduplication by tangent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants