Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e4a6b57

Browse files
Modify tiebreak_on_lca to accept an optional pre-build LCA
These issue helps resolve #36 because inside queries needed to run a whole bunch of tie-breaking runs on smaller collections of data and the overhead of recomputing the LCA tree every time was skyrocketing their response time
1 parent b43492a commit e4a6b57

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

‎queries/argument.py‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ def inverse_transformation(node):
303303
atok = atok,
304304
origin = origin,
305305
select_node = origin if selection[0]!=selection[1] else None,
306-
tiebreaker = lambda x: tiebreak_on_lca(statement_node,origin,x),
306+
tiebreaker = lambda x: tiebreak_on_lca(statement_node,origin,x,lca),
307307
transformation = transformation,
308308
inverse_transformation = inverse_transformation,
309309

@@ -356,7 +356,7 @@ def inverse_transformation(node):
356356
atok = atok,
357357
origin = origin,
358358
select_node = origin if selection[0]!=selection[1] else None,
359-
tiebreaker = lambda x: tiebreak_on_lca(statement_node,origin,x),
359+
tiebreaker = lambda x: tiebreak_on_lca(statement_node,origin,x,lca),
360360
transformation = transformation,
361361
inverse_transformation = inverse_transformation,
362362

@@ -383,7 +383,6 @@ def case_five(self,view_information,query_description, extra = {}):
383383
query_description["level_index"] = -1
384384
_,calling_parents = search_upwards_log(origin,targets=ast.stmt,log_targets=(ast.Call))
385385
index = query_description["level_index"]
386-
print("the Dixie's ",index,len(calling_parents),"\n")
387386
if index<len(calling_parents):
388387
priority["child_level"] = 1
389388
origin = calling_parents[index]

‎queries/tiebreak.py‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66

77

88

9-
10-
def tiebreak_on_lca(root,origin,candidates):
9+
def tiebreak_on_lca(root,origin,candidates,lca = None):
1110
"""ranks nodes based on the depth of their lowest_common_ancestor
1211
With origin (the deeper the better). In case of ties the note
1312
Closer to the LCA is preferred.
@@ -20,7 +19,7 @@ def tiebreak_on_lca(root,origin,candidates):
2019
Returns:
2120
TYPE: Description
2221
"""
23-
lca = LCA(root)
22+
lca = LCA(root)iflcaisNoneelselca
2423
def tiebreaker(x):
2524
depth,node = lca(x, origin,node_and_depth = True)
2625
v = 3

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /