source: orange/orange/doc/Orange/rst/code/network-read.py @ 7257:3ec7d25ecfd2

Revision 7257:3ec7d25ecfd2, 419 bytes checked in by miha <miha.stajdohar@…>, 3 years ago (diff)
Line 
1import Orange.network
2from pylab import *
3
4# read network from file
5net = Orange.network.Network.read("K5.net")
6
7# read all edges and plot a line
8for u, v in net.getEdges():
9    x1, y1 = net.coors[0][u], net.coors[1][u]
10    x2, y2 = net.coors[0][v], net.coors[1][v]
11    plot([x1, x2], [y1, y2], 'b-')
12
13# read x and y coordinates to Python list
14x = net.coors[0]
15y = net.coors[1]
16
17# plot vertices
18plot(x, y, 'ro')
19show()
Note: See TracBrowser for help on using the repository browser.