public string GetAllMutual() { mutualAll = ""; BFSearcher searcher = new BFSearcher(); List<int> firstDegree = searcher.GetListFirstDegree(nodes.IndexOf(nodeSrc), graph); listAllMutual = new List<List<string>>(); foreach (int idx in firstDegree) { AddMutual(nodeSrc, nodes[idx]); } listAllMutual = listAllMutual.OrderBy(list => list.Count()).Reverse().ToList(); mutualAll += "Friend Recommendation for " + nodeSrc + " :\n\n"; foreach (List<string> listMutuals in listAllMutual) { mutualAll += GetMutual(listMutuals) + "\n\n"; } return mutualAll; }
public void ProcessPath() { List<int> path = new List<int>(); Searcher searcher; string message = ""; this.process(); // reset visual graph if (choice == 0) { return; } else if (choice == 2) { // gunakan DFS searcher = new DFSearcher(this, form1); path = searcher.Search(nodes.IndexOf(nodeSrc), nodes.IndexOf(nodeDst), graph); } else if (choice == 1) { // gunakan BFS searcher = new BFSearcher(this, form1); path = searcher.Search(nodes.IndexOf(nodeSrc), nodes.IndexOf(nodeDst), graph); } if (path.Count() == 0) { // jika jalur tidak ditemukan, reset graph process(); message += "No connection found from " + nodeSrc + " to " + nodeDst + "\n"; } else { message += "Account : " + nodeSrc + " and " + nodeDst + "\n"; message += (path.Count()-2) + "-degree connection found\n"; } exploreResult = message + "\n"; //return this; // supaya dapat dilakukan method-chaining }