'Tests that the A* shortest path agrees with Dijkstra\'s
shortest path for a random graph.'

def test_random_graph(self):

    G = nx.Graph()
    points = [(random(), random()) for _ in range(100)]
    for (p1, p2) in pairwise(points):
        G.add_edge(p1, p2, weight=dist(p1, p2))
    for _ in range(100):
        (p1, p2) = (choice(points), choice(points))
        G.add_edge(p1, p2, weight=dist(p1, p2))
    path = nx.astar_path(G, points[0], points[(-1)], dist)
    assert_equal(path, nx.dijkstra_path(G, points[0], points[(-1)]))
