source: orange/orange/doc/modules/network_constructor.py @ 6538:a5f65d7f0b2c

Revision 6538:a5f65d7f0b2c, 558 bytes checked in by Mitar <Mitar@…>, 4 years ago (diff)

Made XPM version of the icon 32x32.

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.