PEP 218 Re: ANN: set-0.1 module available
Roman Suzi
rnd at onego.ru
Tue May 21 04:53:58 EDT 2002
On Tue, 21 May 2002, Roman Suzi wrote:
>
> Maybe we try to use quantitative arguments? Are there any suggestions for
> small benchmarks: we can use set-0.2 to see real efficiency (or lack of),
> etc.
>
> Any nice/classic set-using problems around?
My input:
-----------------------------------------------------
#!/usr/bin/env python2.2
from set import set
"""Making graph from adjency matrix"""
adjency = [
[0, 0, 1, 1, 0, 0, 1],
[1, 0, 0, 1, 0, 0, 1],
[0, 1, 1, 0, 0, 0, 1],
[1, 0, 1, 1, 0, 0, 0],
[0, 0, 1, 1, 1, 0, 1],
[0, 0, 1, 1, 0, 1, 1],
[0, 1, 1, 1, 0, 0, 0],
]
V = set(range(len(adjency)))
E = set([(i, j) for i in V for j in V if adjency[i][j]])
G = (V, E)
print G
---------------------------------------------------------
Sincerely yours, Roman A.Suzi
--
- Petrozavodsk - Karelia - Russia - mailto:rnd at onego.ru -
More information about the Python-list
mailing list