Exemplo n.º 1
0

def process_two():
    for i in range(1, node_number, 2):
        graph.remove_node(nodes[i])


t1 = datetime.now()
print(OKBLUE + "starting deleting the nodes")
p1 = Process(target=process_one)
p2 = Process(target=process_two)
p1.start()
p2.start()
p1.join()
p2.join()

t2 = datetime.now()
c = t2 - t1
print(OKBLUE + "delete completed")

perf = node_number / c.total_seconds()

graph.remove_node(graph.root)
if perf > target:
    print(OKGREEN + "####\nremoving " + str(perf) + " nodes/second\n####")
else:
    print(WARNING + "####\nremoving " + str(perf) + " nodes/second\n####")
    exit_code = 1

exit(exit_code)
Exemplo n.º 2
0
print graph.get_successors(u"p2")
print graph.get_successors(u"c3")
print graph.get_successors(graph.root)
print graph.get_predecessors(u"c3")

#getting an attributs list
print graph.get_attributs_list(u'm2')
#getting some attribut
print graph.get_attribut(u'm2', u'guido')
print graph.get_attribut(u'm1', u'jack')

#example of write off (suppression of some elements of a node, like predecessors, successors or attributs)
#getting the elements before
print graph.get_attributs_list(u'm2')
print graph.get_predecessors(u"m2")
print graph.get_successors("m2")

#removing the elements
graph.write_off_node(u"m2", [u"c1"], [u"p2", u"p3"],[u'sape'])

#getting the elements after
print graph.get_attributs_list(u'm2')
print graph.get_predecessors(u"m2")
print graph.get_successors(u"m2")

#removing a node
graph.remove_node(u'm2')
print graph.get_predecessors(u"m2")
print graph.get_successors(u"m2")
print graph.get_successors(graph.root)
    for i in range(0,node_number,2):
        graph.remove_node(nodes[i])

def process_two():
    for i in range(1,node_number,2):
        graph.remove_node(nodes[i])

t1 = datetime.now()
print(OKBLUE + "starting deleting the nodes")
p1 = Process(target=process_one)
p2 = Process(target=process_two)
p1.start()
p2.start()
p1.join()
p2.join()

t2 = datetime.now()
c = t2 - t1
print(OKBLUE + "delete completed")

perf = node_number / c.total_seconds()

graph.remove_node(graph.root)
if perf > target:
    print( OKGREEN + "####\nremoving " + str(perf) + " nodes/second\n####")
else:
    print( WARNING + "####\nremoving " + str(perf) + " nodes/second\n####")
    exit_code = 1

exit(exit_code)
Exemplo n.º 4
0
print(graph.get_successors("p2"))
print(graph.get_successors("c3"))
print(graph.get_successors(graph.root))
print(graph.get_predecessors("c3"))

#getting an attributs list
print(graph.get_attributs_list('m2'))
#getting some attribut
print(graph.get_attribut('m2', 'guido'))
print(graph.get_attribut('m1', 'jack'))

#example of write off (suppression of some elements of a node, like predecessors, successors or attributs)
#getting the elements before
print(graph.get_attributs_list('m2'))
print(graph.get_predecessors("m2"))
print(graph.get_successors("m2"))

#removing the elements
graph.write_off_node("m2", ["c1"], ["p2", "p3"], ['sape'])

#getting the elements after
print(graph.get_attributs_list('m2'))
print(graph.get_predecessors("m2"))
print(graph.get_successors("m2"))

#removing a node
graph.remove_node('m2')
print(graph.get_predecessors("m2"))
print(graph.get_successors("m2"))
print(graph.get_successors(graph.root))