Skip to content

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

@MiSawa

Description

@MiSawa

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));
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions