Skip to content

Commit

Permalink
Rename/document pinnedness a bit for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickkwang committed Oct 5, 2021
1 parent 0fbab65 commit 552fbbf
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions strider/query_planner.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,20 +247,20 @@ def get_next_qedge(qgraph):
def get_pinnedness(qgraph, qnode_id):
"""Get pinnedness of each node."""
adjacency_mat = get_adjacency_matrix(qgraph)
return -_get_pinnedness_recursively(
return -compute_expected_n(
adjacency_mat,
qnode_id,
)


def _get_pinnedness_recursively(adjacency_mat, qnode_id, last=None, level=0):
"""Get pinnedness of each node, recursively."""
def compute_expected_n(adjacency_mat, qnode_id, last=None, level=0):
"""Compute the expected number of unique knodes bound to the specified qnode in the final results."""
pinnedness = math.log(adjacency_mat[qnode_id][qnode_id])
if level < 10:
for neighbor in adjacency_mat[qnode_id]:
if neighbor in (qnode_id, last):
continue
pinnedness += min(max(_get_pinnedness_recursively(
pinnedness += min(max(compute_expected_n(
adjacency_mat,
neighbor,
qnode_id,
Expand Down

0 comments on commit 552fbbf

Please sign in to comment.