def test_reeb1():
    surf_net = _cp.netx.DiGraph()
    node2h_map = {
            6: 0,
            5: 1,
            4: 2,
            3: 3,
            2: 4,
            1: 5,
            }
    node2h = lambda n: (node2h_map[n], n)

    def _add_edge(n1, n2):
        surf_net.add_edge(n1, n2, dh=abs(node2h(n1)[0] - node2h(n2)[0]))

    _add_edge(1,3)
    _add_edge(1,4)
    _add_edge(2,3)
    _add_edge(2,4)
    _add_edge(3,5)
    _add_edge(3,6)
    _add_edge(4,5)
    _add_edge(4,6)
    peaks  = set([1, 2])
    passes = set([3, 4])
    pits   = set([5, 6])
    crit_pts = cpts(peaks=peaks, passes=passes, pits=pits)
    reeb_gr = _cp.get_reeb_graph(surf_net, crit_pts, node2h)
    ok_(
        compare_graphs(
            reeb_gr.edge,
            {1: [3], 2: [3], 3: [1, 2, 4], 4: [3, 5, 6], 5: [4], 6: [4]}))
def _test_reeb3():
    surf_net = _cp.netx.DiGraph()
    surf_net._g = {
            (5, 15): [(22, 28), (6, 15)],
            (5, 31): [(6, 25), (26, 6), (10, 2)],
            (6, 15): [(27, 0), (5, 15), (6, 16)],
            (6, 16): [(6, 25), (14, 9), (6, 15)],
            (6, 25): [(27, 0), (21, 18), (6, 16), (5, 31)],
            (10, 2): [(21, 18), (27, 0), (5, 31), (16, 3)],
            (14, 9): [(27, 0), (21, 18), (16, 3), (6, 16)],
            (16, 3): [(22, 28), (14, 9), (26, 6), (10, 2)],
            (21, 18): [(6, 25), (22, 28), (14, 9), (26, 6), (10, 2)],
            (22, 28): [(21, 18), (27, 0), (5, 15), (16, 3)],
            (26, 6): [(27, 0), (21, 18), (16, 3), (5, 31)],
            (27, 0): [(6, 25), (22, 28), (14, 9), (26, 6), (6, 15), (10, 2)],
            }
    crit_pts =  {
            'passes': set([(6, 15), (6, 25), (10, 2), (14, 9), (22, 28), (26, 6)]),
            'peaks': set([(21, 18), (27, 0)]),
            'pits': set([(5, 15), (5, 31), (6, 16), (16, 3)]),
            }
    node2h_map = {
            (5, 31): (-0.014356736424827819, (5, 31)),
            (5, 15): (-0.027839962424853988, (5, 15)),
            (6, 25): (-0.0055548455026826482, (6, 25)),
            (6, 15): (-0.027593845591386536, (6, 15)),
            (6, 16): (-0.027642410602253194, (6, 16)),
            (10, 2): (-0.0075859636696798422, (10, 2)),
            (14, 9): (-0.0072652858280034555, (14, 9)),
            (16, 3): (-0.012332851686022498, (16, 3)),
            (21, 18): (0.039444128294746132, (21, 18)),
            (22, 28): (0.0016904116601130521, (22, 28)),
            (26, 6): (0.0064175915669918903, (26, 6)),
            (27, 0): (0.011876681723300701, (27, 0)),
            }
    node2h = lambda n: node2h_map[n]
    reeb_gr = _cp.get_reeb_graph(surf_net, crit_pts, node2h)
    set_trace()
def test_reeb2():
    surf_net = _cp.netx.DiGraph()
    node2h_map = {
            8: 0,
            7: 1,
            6: 1,
            5: 1,
            4: 2,
            3: 2,
            2: 2,
            1: 3,
            }
    node2h = lambda n: (node2h_map[n], n)

    def _add_edge(n1, n2):
        surf_net.add_edge(n1, n2, dh=abs(node2h(n1)[0] - node2h(n2)[0]))

    _add_edge(1,5)
    _add_edge(1,6)
    _add_edge(1,7)
    _add_edge(2,7)
    _add_edge(3,6)
    _add_edge(4,5)
    _add_edge(5,8)
    _add_edge(6,8)
    _add_edge(7,8)
    peaks  = set([1, 2, 3, 4])
    passes = set([5, 6, 7])
    pits   = set([8])
    crit_pts = cpts(peaks=peaks, passes=passes, pits=pits)
    reeb_gr = _cp.get_reeb_graph(surf_net, crit_pts, node2h)
    ok_(
        compare_graphs(
            reeb_gr.edge,
            {1: [7], 2: [7], 3: [6], 4: [5], 5: [4, 8, 6], 6: [3, 7, 5], 7: [1, 2, 6], 8: [5]}))
    return