allpy
view allpy/graph.py @ 746:e83572fff43f
Roll-back a bug introduces by dirty hand-merge in [723]. (closes #74) (see #76)
Boris! Please do not do dirty hand merges! If you did hg fetch here, this bug
would not appear! Please, be extremely careful when you do hand merges and
double-check your changes. Do a diff with each parent and see what you remove
related to the parent! If someone else's code is involved in the merge (which
is almost always the case), do that diff twice just to make sure you have not
missed anything!
author | Daniil Alexeyevsky <dendik@kodomo.fbb.msu.ru> |
---|---|
date | Mon, 11 Jul 2011 14:29:54 +0400 |
parents | f9feb1d40968 |
children | 3cc7ef543da5 |
line source
5 pass
8 """ Undirected weighted graph
10 graph[vertex1][vertex2] = weight
11 * vertex1 != vertex2 (no such edges)
12 * weight is float in (0, 1] or 1 (if all edges are equal)
13 * symmetrical
15 Features:
16 * this graph cannot contain vertices without any edges
18 >>> g = Graph()
19 >>> g.set_edge(1, 2)
20 >>> g.fast_cliques()
21 Fast algorithm started
22 [frozenset([1, 2])]
23 >>> g.set_edge(2, 3)
24 >>> g.set_edge(1, 3)
25 >>> g.fast_cliques()
26 Fast algorithm started
27 [frozenset([1, 2, 3])]
28 >>> g.bron_kerbosh()
29 Bron and Kerbosh algorithm started
30 [frozenset([1, 2, 3])]
31 >>> g.cliques()
32 Bron and Kerbosh algorithm started
33 [frozenset([1, 2, 3])]
35 """