source: orange/Orange/doc/modules/network_constructor.py @ 9671:a7b056375472

Revision 9671:a7b056375472, 558 bytes checked in by anze <anze.staric@…>, 2 years ago (diff)

Moved orange to Orange (part 2)

Line 
1import orngNetwork
2from pylab import *
3
4# create graph object of type GraphAsList
5# vertices are placed randomly in Network constructor
6net = orngNetwork.Network(5, 0)
7
8# set edges
9for i in range(4):
10    for j in range(i + 1, 5):
11        net[i,j] = 1
12
13# read all edges and plot a line
14for u, v in net.getEdges():
15    x1, y1 = net.coors[0][u], net.coors[1][u]
16    x2, y2 = net.coors[0][v], net.coors[1][v]
17    plot([x1, x2], [y1, y2], 'b-')
18
19# read x and y coordinates to Python list
20x = net.coors[0]
21y = net.coors[1]
22
23# plot vertices
24plot(x, y, 'ro')
25show()
Note: See TracBrowser for help on using the repository browser.