Beispiel #1
0
def extract_extremities(g, scale=0, **kwds):
    if scale <= 0:
        vid = first_component_root(g,g.root)
        scale = g.scale(vid)

    vids = g.component_roots_at_scale_iter(g.root, scale=scale)
    leaves = chain.from_iterable(algo.extremities(g,vid) for vid in vids)

    seqs = [list(reversed([vid for vid in algo.ancestors(g,lid)])) for lid in leaves]
    return seqs
Beispiel #2
0
def extract_extremities(g, scale=0, **kwds):
    if scale <= 0:
        vid = first_component_root(g,g.root)
        scale = g.scale(vid)

    vids = g.component_roots_at_scale_iter(g.root, scale=scale)
    leaves = chain.from_iterable(algo.extremities(g,vid) for vid in vids)

    seqs = [list(reversed([vid for vid in algo.ancestors(g,lid)])) for lid in leaves]
    return seqs
Beispiel #3
0
    def test_mtg_sequences(self):
        g = self.g
        topdia = g.property('TopDia')
        nfe = g.property('NFe')

        vid = g.component_roots_at_scale_iter(g.root, g.max_scale()).next()
        leaves = algo.extremities(g,vid)
        seqs = [list(reversed([vid for vid in algo.ancestors(g, lid) if vid in topdia and vid in nfe])) for lid in leaves]

        sequences = build_sequences(g,seqs,['TopDia', 'NFe'])
        return sequences