コード例 #1
0
 public FakeGraph()
 {
     pn = new ParentNode[1000];
     for (int i = 0; i < 1000; i++)
     {
         pn[i] = new ParentNode();
         pn[i].nama = "";
     }
 }
コード例 #2
0
 public ParentNode[] daftartetanggakotatertentu(ParentNode kota)
 {
     ParentNode[] tetangganya = new ParentNode[1000];
     int i=0,idxt=0;
     while ( i < 1000)
     {
         if (!kota.cn[i].namakota.Equals(""))
         {
             tetangganya[idxt] = pn[findindex(kota.cn[i].namakota)];
             idxt++;
         }
         i++;
     }
         return tetangganya;
 }
コード例 #3
0
 public Queue<ParentNode> tetangganyadarikota(ParentNode kota)
 {
     Queue<ParentNode> tetanggaku = new Queue<ParentNode>();
     int i = 0;
     while (i < 1000)
     {
         if (!kota.cn[i].namakota.Equals(""))
         {
             tetanggaku.Enqueue(pn[findindex(kota.cn[i].namakota)]);
         }
         i++;
     }
     return tetanggaku;
 }
コード例 #4
0
 static Boolean sudahdiscoverkah(List<ParentNode> discoveredlist, ParentNode nodetarget)
 {
     Boolean found = false;
     for (int i = 0; i < discoveredlist.Count(); i++)
     {
         if(discoveredlist.ElementAt(i).Equals(nodetarget))
         {
             found=true;
             break;
         }
     }
     return found;
 }