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

All Samples(4)  |  Call(4)  |  Derive(0)  |  Import(0)
Generate a sequence of bipartite directed graphs, each consisting
of the edges from level i to level i+1 of G. Edges that connect
vertices within the same level are not included in the output.
The vertices in each level can be listed by iterating over each
output graph.

        def BreadthFirstLevels(G,root):
    """
    Generate a sequence of bipartite directed graphs, each consisting
    of the edges from level i to level i+1 of G. Edges that connect
    vertices within the same level are not included in the output.
    The vertices in each level can be listed by iterating over each
    output graph.
    """
    visited = set()
    currentLevel = [root]
    while currentLevel:
        for v in currentLevel:
            visited.add(v)
        nextLevel = set()
        levelGraph = {v:set() for v in currentLevel}
        for v in currentLevel:
            for w in G[v]:
                if w not in visited:
                    levelGraph[v].add(w)
                    nextLevel.add(w)
        yield levelGraph
        currentLevel = nextLevel
        


src/p/y/pystream-HEAD/lib/PADS/PartialCube.py   pystream(Download)
 
        # Breadth first search to propagate bitvectors to the rest of the graph
        for LG in BFS.BreadthFirstLevels(CG,root):
            for v in LG:
                for w in LG[v]:

src/p/y/pystream-HEAD/lib/PADS/Medium.py   pystream(Download)
    # find list of tokens that lead to the initial state
    activeTokens = set()
    for LG in BFS.BreadthFirstLevels(G,initialState):
        for v in LG:
            for w in LG[v]:

src/p/a/PADS-0.0.20131119/pads/PartialCube.py   PADS(Download)
 
        # Breadth first search to propagate bitvectors to the rest of the graph
        for LG in BFS.BreadthFirstLevels(CG,root):
            for v in LG:
                for w in LG[v]:

src/p/a/PADS-0.0.20131119/pads/Medium.py   PADS(Download)
    # find list of tokens that lead to the initial state
    activeTokens = set()
    for LG in BFS.BreadthFirstLevels(G,initialState):
        for v in LG:
            for w in LG[v]: