Skip to content

Commit

Permalink
refactor: Simplify updateNodeColors by removing color sequence sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
sanity committed Nov 30, 2024
1 parent b4abd65 commit d2f0345
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions hugo-site/static/html/eventual_convergence_viz.html
Original file line number Diff line number Diff line change
Expand Up @@ -262,11 +262,7 @@ <h1 class="title">Freenet Eventual Convergence Simulation</h1>
// Function to update node colors visually
function updateNodeColors(node) {
const nodeGroup = d3.select(`#node-${node.data.id}`);
// Sort colors by sequence number and take most recent 3
const recentColors = [...node.data.receivedColors].sort((a, b) =>
colorSequenceMap.get(b) - colorSequenceMap.get(a)
).slice(0, 3);
drawPie(nodeGroup, recentColors);
drawPie(nodeGroup, node.data.receivedColors);
}

// Function to get all connected node pairs in the network
Expand Down

0 comments on commit d2f0345

Please sign in to comment.