Пример #1
0
print "---- adjacency_matrix ----"
print adj_mtr

#testing the final (actual client function)
g = extract_graph("eats")
print "---- Graph Bundle ----"
print "Graph_bundle:Labels ="
print g.labels
print "Graph_bundle: Adjacency Matrix ="
print g.adjacency_matrix

#save the graph as an image
g_plot = create_graph(g.labels,g.adjacency_matrix,g.property_str)
render_graph(g_plot, "g_graph")

render_graph_color(g,"g_graph_color")

#test the pebl interface
graph = graph2pebl(g.labels,g.adjacency_matrix)
render_pebl_graph(graph,"test_pebl")

print "Graph_bundle: Adjacency List ="
print g.adjacency_list

print "Graph_bundle: List of edges ="
for i in g.edges:
	print i

print "Graph_bundle: Property ="
print g.property_str
Пример #2
0
graph_b = GraphBundle()
graph_c = GraphBundle()

graph_a.labels = a
graph_a.adjacency_matrix = ad
graph_b.labels = b
graph_b.adjacency_matrix = bd
graph_c.labels = c
graph_c.adjacency_matrix = cd

graph_a.update_state()
graph_a.update_state()
graph_c.update_state()

graph_a.property_str = "isFriend"
graph_b.property_str = "hasSexWith"

g = merge_graph(graph_a,graph_b, graph_c)
render_graph_color(g,"test_merge")

mg = MultiPropGraphBundle()
#~ mg.add_subgraph(graph_a)
#~ mg.add_subgraph(graph_b)
#~ mg.add_subgraph(graph_c)

mg.add_subgraph(graph_a,graph_b,graph_c)
render_graph_color(mg,"test_merge_with multi")
#data_delimiter_change('../datasets/diabetes/diabetes.txt',',','\t')
render_multi_prop_graph(mg,"test_merge_with multi_color")
#generate_training_dataset('../datasets/diabetes/diabetes_pebl.txt','../datasets/diabetes/diabetes_names.txt')