Example #1
0
#compute the adjacency matrix
adj_mtr = compute_adjacency_matrix(labels,solutions,"http://www.hwu.ac.uk/osl/test.owl#eats")
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
Example #2
0
#!/usr/bin/env python
'''
    This is a just a test for the visualization functions i developed
'''

from plot_graph import render_graph
from plot_graph import create_graph
import numpy as np

a = np.array([[ 0,  0,  1],
              [ 0,  1,  0],
              [ 1,  0,  0]])

nodes = ["Creta","Lefkada","Cyprus"]
try:    
	test_graph = create_graph(nodes, a)
	render_graph(test_graph, "test_graph")
except Exception as inst:
	print inst.args[0]