allpy
changeset 1054:53690e470eff
fix a typo in algorithm name Bron?Kerbosch in allpy library
Method Graph.bron_kerbosh() is now deprecated.
Use Graph.bron_kerbosch() instead.
author | Boris Nagaev <bnagaev@gmail.com> |
---|---|
date | Tue, 03 Apr 2012 12:20:13 +0400 |
parents | cf9236900f1c |
children | 6c7e74a75d13 4eec00920444 |
files | allpy/config.py allpy/graph.py allpy/structure.py |
diffstat | 3 files changed, 16 insertions(+), 12 deletions(-) [+] |
line diff
1.1 --- a/allpy/config.py Tue Apr 03 12:06:26 2012 +0400 1.2 +++ b/allpy/config.py Tue Apr 03 12:20:13 2012 +0400 1.3 @@ -15,7 +15,7 @@ 1.4 # pdb download url (XXXX is pdb code place) 1.5 pdb_url = 'http://www.pdb.org/pdb/files/%s.pdb' 1.6 pdb_path = '/tmp/%s.pdb' 1.7 -timeout = 10 # time in sec. for BRON-KERBOSH algorithm 1.8 +timeout = 10 # time in sec. for BRON-KERBOSCH algorithm 1.9 1.10 1.11 # min part or new atoms in new alternative core 1.12 @@ -26,5 +26,5 @@ 1.13 1.14 # blocks3d 1.15 min_width = 4 1.16 -timeout_2 = 10 # bron-kerbosh for blocks 1.17 +timeout_2 = 10 # bron-kerbosch for blocks 1.18
2.1 --- a/allpy/graph.py Tue Apr 03 12:06:26 2012 +0400 2.2 +++ b/allpy/graph.py Tue Apr 03 12:20:13 2012 +0400 2.3 @@ -27,11 +27,11 @@ 2.4 >>> g.fast_cliques() 2.5 Fast algorithm started 2.6 [frozenset([1, 2, 3])] 2.7 - >>> g.bron_kerbosh() 2.8 - Bron and Kerbosh algorithm started 2.9 + >>> g.bron_kerbosch() 2.10 + Bron and Kerbosch algorithm started 2.11 [frozenset([1, 2, 3])] 2.12 >>> g.cliques() 2.13 - Bron and Kerbosh algorithm started 2.14 + Bron and Kerbosch algorithm started 2.15 [frozenset([1, 2, 3])] 2.16 2.17 """ 2.18 @@ -77,7 +77,11 @@ 2.19 self.set_edge(vertex, v, parent_graph[vertex][v]) 2.20 2.21 def bron_kerbosh(self, timeout=-1, minsize=1): 2.22 - """ Bron and Kerboch algorithm implementation 2.23 + """ Deprecated. Use bron_kerbosch() instead """ 2.24 + return self.bron_kerbosch(timeout, minsize) 2.25 + 2.26 + def bron_kerbosch(self, timeout=-1, minsize=1): 2.27 + """ Bron and Kerbosch algorithm implementation 2.28 2.29 returns list of cliques 2.30 clique is frozenset 2.31 @@ -87,7 +91,7 @@ 2.32 if timeout == 0: 2.33 raise TimeoutError() 2.34 if config.debug: 2.35 - print 'Bron and Kerbosh algorithm started' 2.36 + print 'Bron and Kerbosch algorithm started' 2.37 cliques = [] 2.38 2.39 class ExtendCall(object): 2.40 @@ -228,7 +232,7 @@ 2.41 2.42 clique is frozenset 2.43 2.44 - try to execute bron_kerbosh 2.45 + try to execute bron_kerbosch 2.46 if it raises TimeoutError, executes fast_cliques 2.47 """ 2.48 cliques = [] 2.49 @@ -238,7 +242,7 @@ 2.50 if len(neighbours_dict) < minsize - 1 and v in graph: 2.51 graph.drop_vertex(v) 2.52 try: 2.53 - cliques += graph.bron_kerbosh(timeout, minsize) 2.54 + cliques += graph.bron_kerbosch(timeout, minsize) 2.55 except TimeoutError: 2.56 cliques += graph.fast_cliques(minsize) 2.57 cliques.sort(key=lambda clique: len(clique), reverse=True)
3.1 --- a/allpy/structure.py Tue Apr 03 12:06:26 2012 +0400 3.2 +++ b/allpy/structure.py Tue Apr 03 12:20:13 2012 +0400 3.3 @@ -623,7 +623,7 @@ 3.4 GC is set of columns 3.5 3.6 * max_delta -- threshold of distance spreading 3.7 - * timeout -- Bron-Kerbosh timeout (then fast O(n ln n) algorithm) 3.8 + * timeout -- Bron-Kerbosch timeout (then fast O(n ln n) algorithm) 3.9 * minsize -- min size of each core 3.10 * ac_new_atoms -- min part or new atoms in new alternative core 3.11 current GC is compared with each of already selected GCs if 3.12 @@ -725,8 +725,8 @@ 3.13 """ Return length-sorted list of reliable blocks 3.14 3.15 * max_delta -- threshold of distance spreading (ignored if parts) 3.16 - * timeout -- Bron-Kerbosh timeout (couple cores) (ignored if parts) 3.17 - * timeout_2 -- Bron-Kerbosh timeout (blocks) 3.18 + * timeout -- Bron-Kerbosch timeout (couple cores) (ignored if parts) 3.19 + * timeout_2 -- Bron-Kerbosch timeout (blocks) 3.20 * min_width -- min width of each core (ignored if parts) 3.21 * ignore_one_ss -- ignore geometrical cores, owned by one secondary 3.22 structure element in every sequence (ignored if parts)