Did I find the right examples for you? yes no Crawl my project Python Jobs

All Samples(26) | Call(13) | Derive(0) | Import(13)

Union-find data structure. Each unionFind instance X maintains a family of disjoint sets of hashable objects, supporting the following two methods: - X[item] returns a name for the set containing the given item. Each set is named by an arbitrarily-chosen one of its members; as long as the set remains unchanged it will keep the same name. If the item is not yet part of a set in X, a new singleton set is created for it.(more...)

src/p/y/pystream-HEAD/lib/PADS/MinimumSpanningTree.py

**pystream**(Download)

""" from UnionFind import UnionFind def MinimumSpanningTree(G):

# implement once UnionFind exists, and second, because the only slow # part (the sort) is sped up by being built in to Python. subtrees = UnionFind() tree = [] edges = [(G[u][v],u,v) for u in G for v in G[u]]

src/p/a/PADS-0.0.20131119/pads/MinimumSpanningTree.py

**PADS**(Download)

""" from UnionFind import UnionFind def MinimumSpanningTree(G):

# implement once UnionFind exists, and second, because the only slow # part (the sort) is sped up by being built in to Python. subtrees = UnionFind() tree = [] edges = [(G[u][v],u,v) for u in G for v in G[u]]

src/p/y/pystream-HEAD/lib/PADS/PartialCube.py

**pystream**(Download)

import Medium from Bipartite import isBipartite from UnionFind import UnionFind from StrongConnectivity import StronglyConnectedComponents from Graphs import isUndirected

# - CG: contracted graph at current stage of algorithm # - LL: limit on number of remaining available labels UF = UnionFind() CG = dict([(v,dict([(w,(v,w)) for w in G[v]])) for v in G]) NL = len(CG)-1

# Here with all edge equivalence classes represented by UF. # Turn them into a labeled graph and return it. return dict([(v,dict([(w,UF[v,w]) for w in G[v]])) for v in G])

src/p/a/PADS-0.0.20131119/pads/PartialCube.py

**PADS**(Download)

import Medium from Bipartite import isBipartite from UnionFind import UnionFind from StrongConnectivity import StronglyConnectedComponents from Graphs import isUndirected

# - CG: contracted graph at current stage of algorithm # - LL: limit on number of remaining available labels UF = UnionFind() CG = {v:{w:(v,w) for w in G[v]} for v in G} NL = len(CG)-1

# Here with all edge equivalence classes represented by UF. # Turn them into a labeled graph and return it. return {v:{w:UF[v,w] for w in G[v]} for v in G}

src/p/y/pystream-HEAD/lib/PADS/LCA.py

**pystream**(Download)

import unittest,random from UnionFind import UnionFind from sets import Set

# one set for the descendants of each search path node. # self.ancestors maps disjoint set ids to the ancestors themselves. self.descendants = UnionFind() self.ancestors = {}

src/p/y/pystream-HEAD/lib/PADS/CardinalityMatching.py

**pystream**(Download)

from sets import Set from UnionFind import UnionFind from Util import arbitrary_item

# are on the same side of the blossom and w is on the other side. leader = UnionFind() S = {} T = {}

src/p/a/PADS-0.0.20131119/pads/LCA.py

**PADS**(Download)

import unittest,random from collections import defaultdict from UnionFind import UnionFind def _decodeSlice(self,it):

# one set for the descendants of each search path node. # self.ancestors maps disjoint set ids to the ancestors themselves. self.descendants = UnionFind() self.ancestors = {}

src/p/a/PADS-0.0.20131119/pads/CardinalityMatching.py

**PADS**(Download)

import sys from UnionFind import UnionFind from Util import arbitrary_item

# are on the same side of the blossom and w is on the other side. leader = UnionFind() S = {} T = {}

src/s/k/sketchbook-HEAD/lex/DFA.py

**sketchbook**(Download)

from copy import copy from UnionFind import UnionFind # TODO: general code cleanup

self_pairs = [(x, x) for x in self.states] fd_equiv_pairs = sd.right_finite_states(self_pairs) sets = UnionFind() for state in self.states: sets.make_set(state)