Algorithm ɗin Binciken Graph wata babbar dabara ce a fagen sarrafa jadawali da dawo da bayanai. Wannan algorithm yana ba mu damar nemo hanyoyi ko abubuwan haɗin gwiwa a cikin jadawali dangane da takamaiman ƙa'idodi ko algorithms bincike.
Yadda Ake Aiki
- Fara daga takamaiman tsayin daka(ƙumburi) a cikin jadawali.
- Yi tsarin bincike bisa ƙayyadaddun ƙa'idodi, kamar Neman Zurfin-Farko(DFS) ko Bincike na Farko(BFS).
- Mayar da madaidaici da gefuna na jadawali don bincika manufa ko abubuwan da za a samu.
- Yi rikodin hanyar ko sakamakon bincike.
Misali
Yi la'akari da jadawali mai zuwa:
Muna son nemo hanya daga vertex A zuwa vertex E a cikin wannan jadawali ta amfani da Algorithm na Binciken Zurfin Farko(DFS).
- Fara daga vertex A.
- Matsa zuwa sigar B.
- Ci gaba zuwa kishiyar C.
- Babu maƙwabta a cikin C, koma baya zuwa tazarar B.
- Matsa zuwa sigar D.
- Ci gaba zuwa tsaye A(kamar yadda D aka haɗa zuwa A).
- Matsa zuwa sigar B.
- Matsa zuwa sigar C.
- Matsa zuwa ƙwanƙwasa E.
Hanyar daga A zuwa E shine A -> B -> C -> E.
Misali Code a C++
A cikin wannan misali, muna amfani da algorithm na DFS don nemo hanya daga vertex A zuwa vertex E a cikin jadawali. Sakamakon zai kasance jeri na madaidaicin kafa hanya daga A zuwa E.