|
@@ -1078,7 +1078,7 @@ def get_directly_reachable_blocks(block):
|
|
|
|
|
|
def get_reachable_blocks(entry_point):
|
|
|
"""Constructs the set of all reachable vertices from the given block."""
|
|
|
- # This is a simple O(n^2) algorithm. Maybe a faster algorithm is more appropriate here.
|
|
|
+ # This is a simple O(n) algorithm.
|
|
|
def __add_block_children(block, results):
|
|
|
for child in get_directly_reachable_blocks(block):
|
|
|
if child not in results:
|
|
@@ -1092,7 +1092,7 @@ def get_reachable_blocks(entry_point):
|
|
|
def get_all_reachable_blocks(entry_point):
|
|
|
"""Constructs the set of all reachable vertices, for every block that is
|
|
|
reachable from the given entry point."""
|
|
|
- # This is a simple O(n^3) algorithm. Maybe a faster algorithm is more appropriate here.
|
|
|
+ # This is a simple O(n^2) algorithm. Maybe a faster algorithm is more appropriate here.
|
|
|
results = {}
|
|
|
all_blocks = get_reachable_blocks(entry_point)
|
|
|
results[entry_point] = all_blocks
|