示例#1
0
    def tester_graph_2():
        graph = GraphObject(None, 5000, 5000, 20, 3, 10)
        node1 = NodeObject("a26", {'x': 614, 'y': 600}, 50, Colours['yellow'])
        node2 = NodeObject("ce5", {
            'x': -2465,
            'y': 2732
        }, 50, Colours['yellow'])
        node3 = NodeObject("4ec", {'x': -3229, 'y': 3455}, 50, Colours['red'])
        node4 = NodeObject("5e7", {'x': -1184, 'y': 3385}, 50, Colours['blue'])
        node5 = NodeObject("5ea", {'x': 303, 'y': 1050}, 50, Colours['red'])
        node6 = NodeObject("a97", {'x': -1128, 'y': 1884}, 50, Colours['blue'])
        node7 = NodeObject("5f3", {'x': -2910, 'y': 271}, 50, Colours['red'])
        node8 = NodeObject("68f", {'x': -1105, 'y': 1409}, 50, Colours['blue'])
        node9 = NodeObject("a0f", {
            'x': -1598,
            'y': 4054
        }, 50, Colours['yellow'])
        node10 = NodeObject("b3b", {'x': 1047, 'y': 61}, 50, Colours['red'])
        node11 = NodeObject("379", {'x': -1034, 'y': 2046}, 50, Colours['red'])
        node12 = NodeObject("c5c", {'x': 1543, 'y': 4466}, 50, Colours['red'])
        node13 = NodeObject("97b", {
            'x': -2551,
            'y': 1694
        }, 50, Colours['yellow'])
        node14 = NodeObject("ac2", {'x': 821, 'y': 4534}, 50, Colours['blue'])
        node15 = NodeObject("788", {
            'x': -2790,
            'y': 2330
        }, 50, Colours['yellow'])
        node16 = NodeObject("01d", {'x': 450, 'y': 300}, 50, Colours['blue'])
        node17 = NodeObject("e29", {
            'x': -272,
            'y': 910
        }, 50, Colours['yellow'])
        node18 = NodeObject("d21", {
            'x': -2329,
            'y': 2245
        }, 50, Colours['blue'])
        node19 = NodeObject("7ac", {'x': 693, 'y': 3124}, 50, Colours['blue'])
        node20 = NodeObject("189", {
            'x': -2748,
            'y': 3403
        }, 50, Colours['blue'])

        graph.node_list.append(node1)
        graph.node_list.append(node2)
        graph.node_list.append(node3)
        graph.node_list.append(node4)
        graph.node_list.append(node5)
        graph.node_list.append(node6)
        graph.node_list.append(node7)
        graph.node_list.append(node8)
        graph.node_list.append(node9)
        graph.node_list.append(node10)
        graph.node_list.append(node11)
        graph.node_list.append(node12)
        graph.node_list.append(node13)
        graph.node_list.append(node14)
        graph.node_list.append(node15)
        graph.node_list.append(node16)
        graph.node_list.append(node17)
        graph.node_list.append(node18)
        graph.node_list.append(node19)
        graph.node_list.append(node20)

        graph.connections = [('01d', 'e29'), ('01d', 'a97'), ('ac2', 'ce5'),
                             ('379', 'ce5'), ('4ec', 'c5c'), ('5e7', '68f'),
                             ('5e7', '5ea'), ('5ea', '788'), ('a0f', 'a97'),
                             ('5f3', 'b3b'), ('68f', '7ac'), ('a0f', 'd21'),
                             ('a26', 'b3b'), ('189', '379'), ('97b', 'c5c'),
                             ('97b', 'e29'), ('a26', 'ac2'), ('788', '7ac'),
                             ('189', 'd21')]
        graph.center_node = "01d"

        return graph
示例#2
0
 def tester_graph_1():
     graph = GraphObject(None, 800, 400, 6, 4, 5)
     node1 = NodeObject(188, {
         'x': 369,
         'y': 168
     }, 50, {
         'R': 1,
         'G': 0,
         'B': 0,
         'name': "red"
     })
     node2 = NodeObject(-55, {
         'x': 480,
         'y': 275
     }, 50, {
         'R': 0,
         'G': 1,
         'B': 0,
         'name': "green"
     })
     node3 = NodeObject(640, {
         'x': 628,
         'y': 169
     }, 50, {
         'R': 0,
         'G': 0,
         'B': 1,
         'name': "blue"
     })
     node4 = NodeObject(206, {
         'x': 636,
         'y': 306
     }, 50, {
         'R': 1,
         'G': 0,
         'B': 1,
         'name': "magenta"
     })
     node5 = NodeObject(-67, {
         'x': 250,
         'y': 289
     }, 50, {
         'R': 1,
         'G': 1,
         'B': 0,
         'name': "yellow"
     })
     node6 = NodeObject(186, {
         'x': 184,
         'y': 71
     }, 50, {
         'R': 0,
         'G': 1,
         'B': 1,
         'name': "cyan"
     })
     graph.node_list.append(node1)
     graph.node_list.append(node2)
     graph.node_list.append(node3)
     graph.node_list.append(node4)
     graph.node_list.append(node5)
     graph.node_list.append(node6)
     graph.connections = [(640, 188), (-55, 206), (-55, 186), (-67, 640),
                          (-67, 206), (640, 206), (-67, 186), (640, 186)]
     graph.center_node = 188
     graph.question_object_list = GraphTester.create_questions()
     return graph