In my program, Density represents the count that indicates number of nodes connected to particular node. For example, if some node has density of 3, that indicates it is connected to 3 other nodes in the undirected graph. I want to decide the node that has highest density. Till now I am doing something like this:
public Node LeaderIs(List<Node> list)
{
for (int k = 0; k < list.Count; k++)
{
var i = YelloWPages.GetNode(k, list);
for (int l = 0; l < list.Count; l++)
{
var j = YelloWPages.GetNode(l, list);
if (Node.GetDensity(i) > Node.GetDensity(j))
{
Node Leadernode = i;
}
}
}
}
I have two questions:
- If this is correct? And if yes, from where should I return the Leadernode?
- If it is not correct, where I have went wrong and what implementation can be done to get
Leadernode
?