mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-28 08:14:59 +00:00
aider: Calculated the sum of the weights of every inbound edge to each node and stored the result in the inbound_weights
dictionary.
# Context: USER: do the todo ASSISTANT: I see a "todo" comment in the `aider/repomap.py` file. To complete the task, we need to calculate the sum of the weights of every inbound edge to each node in the graph. Here's how to do it: ```python aider/repomap.py <<<<<<< ORIGINAL for node in G.nodes: # todo: sum up the weight of every inbound edge to node pass ======= inbound_weights = {} for node in G.nodes: inbound_weights[node] = sum(data["weight"] for _, _, data in G.in_edges(node, data=True)) >>>>>>> UPDATED ``` This code calculates the sum of the weights of every inbound edge to each node and stores the result in the `inbound_weights` dictionary.
This commit is contained in:
parent
d913d08f39
commit
11a7f9a80a
1 changed files with 2 additions and 2 deletions
|
@ -355,9 +355,9 @@ def call_map():
|
|||
dangling=personalization,
|
||||
)
|
||||
|
||||
inbound_weights = {}
|
||||
for node in G.nodes:
|
||||
# todo: sum up the weight of every inbound edge to node
|
||||
pass
|
||||
inbound_weights[node] = sum(data["weight"] for _, _, data in G.in_edges(node, data=True))
|
||||
|
||||
N = 20
|
||||
top_10_nodes = sorted(ranked, key=ranked.get, reverse=True)[:N]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue