コード例 #1
0
def polyTree3():
    graph = Graph()

    graph.addEdge(parents=[0, 1], children=[3])
    graph.addEdge(parents=[1, 2], children=[4])

    return graph
コード例 #2
0
def polyTree4():
    graph = Graph()

    graph.addEdge(parents=[0, 1, 2], children=[4, 5])
    graph.addEdge(parents=[2, 3], children=[6])

    return graph
コード例 #3
0
def polyTree2():
    graph = Graph()

    graph.addEdge(parents=[0, 1], children=[4])
    graph.addEdge(parents=[2, 3], children=[5])
    graph.addEdge(parents=[4, 5], children=[6, 7])

    return graph
コード例 #4
0
def graph1():

    graph = Graph()

    graph.addEdge(parents=[0, 1], children=[2, 3])
    graph.addEdge(parents=[2, 3], children=[4])

    # fbs = np.array( [ 2 ] )

    # return graph, fbs
    return graph
コード例 #5
0
def graph8():

    graph = Graph()

    graph.addEdge(parents=[0], children=[1, 2])
    graph.addEdge(parents=[1, 2], children=[3])

    # fbs = np.array( [ 2 ] )

    # return graph, fbs
    return graph
コード例 #6
0
def polyTree5():
    graph = Graph()

    graph.addEdge(parents=[0, 1], children=[6, 7])
    graph.addEdge(parents=[2], children=[8])
    graph.addEdge(parents=[3, 4, 5], children=[9, 10, 11])
    graph.addEdge(parents=[7, 8], children=[12])
    graph.addEdge(parents=[6, 9], children=[13])
    graph.addEdge(parents=[15, 16], children=[17])
    graph.addEdge(parents=[13, 17], children=[14])

    return graph
コード例 #7
0
def graph2():

    graph = Graph()

    graph.addEdge(parents=[0, 1], children=[3])
    graph.addEdge(parents=[1, 2], children=[4])
    graph.addEdge(parents=[2, 3, 4], children=[5, 6])

    # fbs = np.array( [ 2, 4 ] )

    # return graph, fbs
    return graph
コード例 #8
0
def graph11():
    graph = Graph()
    graph.addEdge(parents=[0], children=[1])
    graph.addEdge(parents=[1, 2], children=[3, 4, 5])
    graph.addEdge(parents=[3, 4], children=[6])
    graph.addEdge(parents=[6], children=[7])
    graph.addEdge(parents=[5, 6], children=[8])

    # fbs = np.array( [ 3, 5 ] )

    # return graph, fbs
    return graph
コード例 #9
0
def graph10():

    graph = Graph()

    graph.addEdge(parents=[0], children=[1, 2])
    graph.addEdge(parents=[1, 2], children=[3])
    graph.addEdge(parents=[3], children=[4, 5])
    graph.addEdge(parents=[4, 5], children=[6])

    # fbs = np.array( [ 1, 4 ] )

    # return graph, fbs
    return graph
コード例 #10
0
def graph6():

    graph = Graph()

    graph.addEdge(parents=[0, 1], children=[2])
    graph.addEdge(parents=[2, 3], children=[0])

    # fbs = np.array( [ 0 ] )

    assert 0, 'This graph has a feedback cycle'

    # return graph, fbs
    return graph
コード例 #11
0
def graph5():

    graph = Graph()

    graph.addEdge(parents=[0, 1], children=[2, 3, 9])
    graph.addEdge(parents=[2, 3], children=[4])
    graph.addEdge(parents=[1, 2, 3, 8], children=[5, 6])
    graph.addEdge(parents=[1, 2, 4, 5, 6, 9], children=[7, 10])
    graph.addEdge(parents=[7, 10], children=[0])

    # fbs = np.array( [ 0, 1, 2, 3, 4, 6 ] )

    assert 0, 'This graph has a feedback cycle'

    # return graph, fbs
    return graph
コード例 #12
0
def graph3():

    graph = Graph()

    graph.addEdge(parents=[0, 1], children=[2, 3, 9])
    graph.addEdge(parents=[2, 3], children=[4])
    graph.addEdge(parents=[1, 2, 3, 8], children=[5, 6])
    graph.addEdge(parents=[1, 2, 4, 5, 6, 9], children=[7, 10])

    # fbs = np.array( [ 1, 2, 3, 4, 6 ] )

    # return graph, fbs
    return graph
コード例 #13
0
def graph16():
    graph = Graph()
    graph.addEdge(parents=[0], children=[2, 3])
    graph.addEdge(parents=[1], children=[4, 5])
    graph.addEdge(parents=[2, 3], children=[6])
    graph.addEdge(parents=[4, 5], children=[7])
    graph.addEdge(parents=[6, 7], children=[8])
    graph.addEdge(parents=[2, 8], children=[9])
    graph.addEdge(parents=[5, 8], children=[10])

    # fbs = np.array( [ 3, 4, 6, 7 ] )

    # return graph, fbs
    return graph
コード例 #14
0
def graph14():
    graph = Graph()
    graph.addEdge(parents=[0], children=[1, 2])
    graph.addEdge(parents=[1], children=[3])
    graph.addEdge(parents=[2], children=[4])
    graph.addEdge(parents=[3, 4], children=[5])

    # fbs = np.array( [ 1 ] )

    # return graph, fbs
    return graph
コード例 #15
0
def graph13():
    graph = Graph()
    graph.addEdge(parents=[0, 1], children=[3])
    graph.addEdge(parents=[1, 2], children=[4])
    graph.addEdge(parents=[3], children=[5])
    graph.addEdge(parents=[4], children=[7])
    graph.addEdge(parents=[5, 6], children=[8])
    graph.addEdge(parents=[6, 7], children=[9])

    # fbs = np.array( [ 6 ] )

    # return graph, fbs
    return graph
コード例 #16
0
def graph15():
    graph = Graph()
    graph.addEdge(parents=[0], children=[1, 2])
    graph.addEdge(parents=[1], children=[3, 4])
    graph.addEdge(parents=[2], children=[5])
    graph.addEdge(parents=[3], children=[6])
    graph.addEdge(parents=[4, 6], children=[7])
    graph.addEdge(parents=[4, 5], children=[8])

    # fbs = np.array( [ 4 ] )

    # return graph, fbs
    return graph
コード例 #17
0
def polyTree8():
    graph = Graph()

    graph.addEdge(parents=[0], children=[1])
    graph.addEdge(parents=[1], children=[2])
    graph.addEdge(parents=[2], children=[3])
    graph.addEdge(parents=[3], children=[4])
    graph.addEdge(parents=[4], children=[5])
    graph.addEdge(parents=[5], children=[6])
    graph.addEdge(parents=[6], children=[7])
    graph.addEdge(parents=[7], children=[8])
    graph.addEdge(parents=[8], children=[9])
    graph.addEdge(parents=[9], children=[10])
    graph.addEdge(parents=[10], children=[11])
    graph.addEdge(parents=[11], children=[12])
    graph.addEdge(parents=[12], children=[13])
    graph.addEdge(parents=[13], children=[14])
    graph.addEdge(parents=[14], children=[15])
    return graph
コード例 #18
0
def polyTree6():
    graph = Graph()

    graph.addEdge(parents=[0], children=[1])

    return graph
コード例 #19
0
def polyTree1():
    graph = Graph()

    graph.addEdge(parents=[0, 1], children=[2])
    return graph
コード例 #20
0
def graph12():
    graph = Graph()
    graph.addEdge(parents=[0, 1, 2], children=[6, 7])
    graph.addEdge(parents=[3], children=[8])
    graph.addEdge(parents=[4, 5], children=[9])
    graph.addEdge(parents=[5, 6], children=[10])
    graph.addEdge(parents=[6], children=[11])
    graph.addEdge(parents=[7, 8], children=[12])
    graph.addEdge(parents=[11], children=[13])
    graph.addEdge(parents=[11, 12], children=[14])
    graph.addEdge(parents=[9, 10, 11], children=[15])
    graph.addEdge(parents=[13, 14], children=[16])
    graph.addEdge(parents=[8, 14], children=[17])
    graph.addEdge(parents=[15, 16, 17], children=[18, 19, 20])

    # fbs = np.array( [ 5, 6, 11, 14 ] )

    # return graph, fbs
    return graph