From b2a46b9b37d7d5dc1688d29fddf873c0e3f896af Mon Sep 17 00:00:00 2001 From: jfinkels Date: Tue, 5 Jul 2016 09:19:04 -0400 Subject: Corrects logarithm base in example --- examples/algorithms/beam_search.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/algorithms/beam_search.py b/examples/algorithms/beam_search.py index abc7027c..64f7de53 100644 --- a/examples/algorithms/beam_search.py +++ b/examples/algorithms/beam_search.py @@ -58,7 +58,9 @@ def progressive_widening_search(G, source, value, condition, initial_width=1): # least the number of nodes in the graph, so the final invocation of # `bfs_beam_edges` is equivalent to a plain old breadth-first # search. Therefore, all nodes will eventually be visited. - log_m = math.ceil(math.log(len(G))) + # + # TODO In Python 3.3+, this should be `math.log2(len(G))`. + log_m = math.ceil(math.log(len(G), 2)) for i in range(log_m): width = initial_width * pow(2, i) # Since we are always starting from the same source node, this -- cgit v1.2.1