private GroupC GroupsGo(int n) { GroupC groups = new GroupC(new List <NodeC>()); NodeC maxenemies = CheckMaxEnemies(cs); groups.nodesingroup.Add(maxenemies); AddFriends(maxenemies, groups, n); GroupColor(groups); return(groups); }
private void GroupColor(GroupC groups) { for (int i = 0; i < nodes.Count; i++) { for (int j = 0; j < groups.nodesingroup.Count; j++) { if (nodes[i] == groups.nodesingroup[j]) { nodes[i].color = Color.Gold; } } } }
private void AddFriends(NodeC a, GroupC groups, int n) { for (int i = 0; i < a.edge.Count; i++) { if (cs.Contains(a) && cs.Contains(a.edge[i].Neighbour)) { if (TestEdge(GetNodeIndex(a.edge[i].Neighbour), GetNodeIndex(a)) && a.edge[i].relation == 1) { groups.nodesingroup.Add(a.edge[i].Neighbour); } } } for (int i = 0; i < groups.nodesingroup.Count; i++) { if (!groups.CheckInt(n, groups.NumberOfEnemies(groups.nodesingroup[i]))) { groups.nodesingroup.Remove(groups.CheckMaxEnemies()); } } }