mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 16:54:59 +00:00
cleanup
This commit is contained in:
parent
bb0d58020c
commit
594c4b600b
1 changed files with 11 additions and 6 deletions
|
@ -354,14 +354,19 @@ def call_map():
|
||||||
dangling=personalization,
|
dangling=personalization,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
top_rank = sorted([(rank, node) for (node, rank) in ranked.items()], reverse=True)
|
||||||
|
# Print the PageRank of each node
|
||||||
|
for rank, node in top_rank:
|
||||||
|
print(f"{rank:.03f} {node}")
|
||||||
|
|
||||||
# distribute the rank from each source node, across all of its out edges
|
# distribute the rank from each source node, across all of its out edges
|
||||||
ranked_definitions = defaultdict(float)
|
ranked_definitions = defaultdict(float)
|
||||||
for src in G.nodes:
|
for dst in G.nodes:
|
||||||
src_rank = ranked[src]
|
dst_rank = ranked[dst]
|
||||||
total_weight = sum(data["weight"] for _src, _dst, data in G.in_edges(src, data=True))
|
total_weight = sum(data["weight"] for _src, _dst, data in G.in_edges(dst, data=True))
|
||||||
dump(src, src_rank, total_weight)
|
dump(dst, dst_rank, total_weight)
|
||||||
for src, dst, data in G.in_edges(src, data=True):
|
for _src, _dst, data in G.in_edges(dst, data=True):
|
||||||
data["rank"] = data["weight"] / total_weight * src_rank
|
data["rank"] = data["weight"] / total_weight * dst_rank
|
||||||
ident = data["ident"]
|
ident = data["ident"]
|
||||||
ranked_definitions[(dst, ident)] += data["rank"]
|
ranked_definitions[(dst, ident)] += data["rank"]
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue