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:
Paul Gauthier 2023-06-01 10:56:41 -07:00
parent d913d08f39
commit 11a7f9a80a

View file

@ -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]