mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 09:14:59 +00:00
rank flows evenly *out* from a node
This commit is contained in:
parent
33f649dbbd
commit
746f4ccb56
1 changed files with 6 additions and 6 deletions
|
@ -361,12 +361,12 @@ def call_map():
|
||||||
|
|
||||||
# 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 dst in G.nodes:
|
for src in G.nodes:
|
||||||
dst_rank = ranked[dst]
|
src_rank = ranked[src]
|
||||||
total_weight = sum(data["weight"] for _src, _dst, data in G.in_edges(dst, data=True))
|
total_weight = sum(data["weight"] for _src, _dst, data in G.out_edges(src, data=True))
|
||||||
dump(dst, dst_rank, total_weight)
|
dump(src, src_rank, total_weight)
|
||||||
for _src, _dst, data in G.in_edges(dst, data=True):
|
for _src, dst, data in G.out_edges(src, data=True):
|
||||||
data["rank"] = dst_rank * data["weight"] / total_weight
|
data["rank"] = src_rank * data["weight"] / total_weight
|
||||||
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