Dab tsi yog qhov dav thawj qhov kev tshawb fawb hauv kev txawj ntse?
Dab tsi yog qhov dav thawj qhov kev tshawb fawb hauv kev txawj ntse?

Video: Dab tsi yog qhov dav thawj qhov kev tshawb fawb hauv kev txawj ntse?

Video: Dab tsi yog qhov dav thawj qhov kev tshawb fawb hauv kev txawj ntse?
Video: Saib Mis paub Poj niam (hluas nkauj) tus yam ntxwv lub siab 2024, Kaum ib hlis
Anonim

Tshaj tawm rau lub Plaub Hlis 4, 2017. Dav - Nrhiav thawj zaug yog zoo li traversing ib tsob ntoo qhov twg txhua node yog ib lub xeev uas tej zaum yuav ib tug muaj peev xwm sib tw rau kev daws. Nws nthuav cov nodes los ntawm cov cag ntoo thiab tom qab ntawd tsim ib theem ntawm tsob ntoo ntawm ib lub sij hawm kom txog rau thaum pom muaj kev daws teeb meem.

Ib yam li ntawd, dab tsi yog qhov tob ua ntej nrhiav hauv kev txawj ntse?

Qhov tob - thawj nrhiav ( DFS ) yog ib qho algorithm rau traversing los yog nrhiav tsob ntoo lossis daim duab cov ntaub ntawv. Lub algorithm pib ntawm lub hauv paus node (xaiv ib co arbitrary node raws li lub hauv paus node nyob rau hauv cov ntaub ntawv ntawm ib daim duab) thiab tshawb nrhiav kom deb li deb tau raws li txhua ceg ua ntej backtracking.

Tsis tas li ntawd, dab tsi yog qhov zoo tshaj plaws kev tshawb nrhiav hauv kev txawj ntse? Zoo tshaj - thawj nrhiav yog a nrhiav algorithm uas tshawb txog ib daim duab los ntawm kev nthuav dav cov kev cog lus feem ntau xaiv raws li txoj cai. Hom tshwj xeeb ntawm no nrhiav hu ua greedy zoo tshaj plaws - thawj nrhiav los yog ntshiab tshawb nrhiav heuristic.

Tsis tas li ntawd, qhov dav thawj qhov kev tshawb nrhiav nrog piv txwv yog dab tsi?

Breadth Thawj Nrhiav ( BFS ) algorithm traverses ib daim duab nyob rau hauv ib tug dav dav motion thiab siv ib tug queue kom nco ntsoov kom tau lub vertex tom ntej no mus pib ib tug nrhiav , thaum kawg tuag tshwm sim nyob rau hauv tej iteration. Raws li nyob rau hauv piv txwv muab saum toj no, BFS algorithm traverses ntawm A mus rau B rau E rau F ua ntej ces mus rau C thiab G kawg mus rau D.

Kev tshawb nrhiav dav dav siv rau dab tsi?

Dav - thawj nrhiav (BFS) yog ib daim duab tseem ceeb nrhiav algorithm uas yog siv rau daws ntau yam teeb meem nrog rau kev nrhiav txoj hauv kev luv tshaj plaws hauv daim duab thiab daws cov kev ua si sib tw (xws li Rubik's Cubes).

Pom zoo: