source: orange/Orange/testing/regression/tests_20/modules_network_constructor.py @ 9952:986e9cd806f4

Revision 9952:986e9cd806f4, 558 bytes checked in by Miha Stajdohar <miha.stajdohar@…>, 2 years ago (diff)

Tests moved and renamed from orange 20.

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.