8000 Prims algorithm for sparse graphs needs some more elaboration · Issue #1426 · cp-algorithms/cp-algorithms · GitHub
[go: up one dir, main page]

Skip to content
Prims algorithm for sparse graphs needs some more elaboration #1426
Open
@notimeforcaution

Description

@notimeforcaution

Link: https://cp-algorithms.com/graph/mst_prim.html#sparse-graphs-om-log-n

Edge in all the other places across document contains the weight and the already-selected node to which it is directed towards. For example: The i element in vector<Edge> min_e(N) implies that the smallest cost with which it can be connected to an already-selected node is 'w' and that already-selected node is 'to'.

However, in the implementation for sparse graphs, the set<Edge> contains all edges which connect selected to not-selected nodes, where 'to' now contains a node which is not already selected.

Implying at one place the to in Edge refers to selected nodes, whereas in other places it refers to non-selected nodes. While the algorithm still works best, but I think this bit can be clarified.

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

      0