def test_mst():
    # Make sure we get the same results for undirected graphs.
    # Example from: http://en.wikipedia.org/wiki/Kruskal's_algorithm
    G = nx.Graph()
    edgelist = [(0, 3, [('weight', 5)]),
                (0, 1, [('weight', 7)]),
                (1, 3, [('weight', 9)]),
                (1, 2, [('weight', 8)]),
                (1, 4, [('weight', 7)]),
                (3, 4, [('weight', 15)]),
                (3, 5, [('weight', 6)]),
                (2, 4, [('weight', 5)]),
                (4, 5, [('weight', 8)]),
                (4, 6, [('weight', 9)]),
                (5, 6, [('weight', 11)])]
    G.add_edges_from(edgelist)
    G = G.to_directed()
    x = branchings.minimum_spanning_arborescence(G)

    edges =  [(set([0, 1]), 7), (set([0, 3]), 5), (set([3, 5]), 6),
              (set([1, 4]), 7), (set([4, 2]), 5), (set([4, 6]), 9)]

    assert_equal(x.number_of_edges(), len(edges))
    for u, v, d in x.edges(data=True):
        assert_true( (set([u,v]), d['weight']) in edges )
dataset/ETHPy150Open networkx/networkx/networkx/algorithms/tree/tests/test_branchings.py/test_mst/original