diff options
author | jfinkels <jfinkels@users.noreply.github.com> | 2016-07-05 09:19:04 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-05 09:19:04 -0400 |
commit | b2a46b9b37d7d5dc1688d29fddf873c0e3f896af (patch) | |
tree | cf3993f5c521d53f4472f268d848e93471e9d80b | |
parent | 023da239fb5f76eca2107db312db39fa4f4c206b (diff) | |
download | networkx-beam-log-2.tar.gz |
Corrects logarithm base in examplebeam-log-2
-rw-r--r-- | examples/algorithms/beam_search.py | 4 |
1 files changed, 3 insertions, 1 deletions
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 |