Do a full traversal. DFS/BFS are both ok.
If performance not an issue, maintain data in node for max number of connections to other machines.
Create a HashMap. Key is maximum number of node connections to other machines. Value is the node.
Find a node with the highest connections. Verify connections. Move the node to the machine with the highest connections. Update the Hashmap for this node. Repeat.
Handle conditions of one machine getting full.
For Supernodes, max # of nodes.
Optimization:
Maintain times of access of node connection. Instead of # of nodes, have weighted average of nodes being accessed on another machine. Move those nodes.
No comments:
Post a Comment