net.adj = mst.adj
net.show()

from pymote.network import Network
net = Network()

node = net.add_node(pos=[200, 300])
node = net.add_node(pos=[300, 300])
node = net.add_node(pos=[100, 200])
node = net.add_node(pos=[400, 200])
node = net.add_node(pos=[200, 100])
node = net.add_node(pos=[300, 100])

a = Graph()
a.add_edge(net.nodes()[0], net.nodes()[1], weight=1.1)
a.add_edge(net.nodes()[0], net.nodes()[2], weight=1.7)
a.add_edge(net.nodes()[0], net.nodes()[4], weight=2.6)
a.add_edge(net.nodes()[1], net.nodes()[3], weight=3.1)
a.add_edge(net.nodes()[2], net.nodes()[4], weight=3.8)
a.add_edge(net.nodes()[3], net.nodes()[5], weight=3.7)
a.add_edge(net.nodes()[4], net.nodes()[5], weight=2.1)
net.adj = a.adj
net.show()

mst = minimum_spanning_tree(net)
net.adj = mst.adj
net.show()

write_pickle(net, 'all.tar.gz')
g.add_edge(net.nodes()[0], net.nodes()[1], weight=0.5)

g.add_edge(net.nodes()[1], net.nodes()[2], weight=1.414)
g.add_edge(net.nodes()[1], net.nodes()[3], weight=2.414)
g.add_edge(net.nodes()[1], net.nodes()[4], weight=3.414)
g.add_edge(net.nodes()[1], net.nodes()[5], weight=4.414)

g.add_edge(net.nodes()[2], net.nodes()[3], weight=1)
g.add_edge(net.nodes()[3], net.nodes()[4], weight=2)
g.add_edge(net.nodes()[4], net.nodes()[5], weight=3)

g.add_edge(net.nodes()[2], net.nodes()[4], weight=2.5)
g.add_edge(net.nodes()[2], net.nodes()[5], weight=3.66)
g.add_edge(net.nodes()[3], net.nodes()[5], weight=3.33)

net.adj = g.adj
net.show()
write_pickle(net, 'WorstCaseBezAlg.tar.gz')

#nacrtaj s težinama,
#pozicija nodova nije uredu?! Kako izvući poziciju?

pos = spring_layout(net.pos)
#pos=get_node_attributes(g,net.pos)
figure(2)
#draw(g,pos)
# specifiy edge labels explicitly
edge_labels = dict([((
    u,
    v,
), d['weight']) for u, v, d in g.edges(data=True)])