Skip to content

A new graph instance should be passed to iterate #1

Open
@JLHwung

Description

@JLHwung

On the iterate step, the graph g is passed to iterate. However, as ContractEdge mutates the graph, it will render contracted g passed to iterate on the second and all the following rounds.

https://github.com/chasestarr/mincut/blob/master/mincut.go#L17 should have been something like

if m := iterate(g.Clone(), listedTwice); m < min {
    min = m
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions