dkh.graph.directedmst

Calculate directed minimam spanning tree

  • Declaration

    struct DirectedMSTInfo(E, C);

    Information of directed mst

    • Declaration

      C cost;

      mst cost

    • res

      Declaration

      E[] res;

      edge list

  • Declaration

    DirectedMSTInfo!(_E, D) directedMST(T, _E = EdgeType!T, D = typeof(_E.dist))(T _g, size_t r);

    calc directed mst

    Examples

    1. import std.typecons; alias E = Tuple!(int, "to", int, "dist"); E[][] g = new E[][4]; g[0] ~= E(1, 10); g[2] ~= E(1, 10); g[3] ~= E(1, 3); g[2] ~= E(3, 4); auto info = directedMSTSlow(g, 1); assert(info.cost == 17);