<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Bellman-Ford Archives - Halil Durmus</title>
	<atom:link href="https://www.halildurmus.com/tag/bellman-ford/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.halildurmus.com/tag/bellman-ford/</link>
	<description>Official Website</description>
	<lastBuildDate>Sat, 10 Oct 2020 15:22:45 +0000</lastBuildDate>
	<language>tr</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://www.halildurmus.com/wp-content/uploads/2020/06/1-HalilDurmusRetina-150x150.png</url>
	<title>Bellman-Ford Archives - Halil Durmus</title>
	<link>https://www.halildurmus.com/tag/bellman-ford/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Bellman-Ford Algoritması</title>
		<link>https://www.halildurmus.com/2020/10/10/bellman-ford-algoritmasi/</link>
					<comments>https://www.halildurmus.com/2020/10/10/bellman-ford-algoritmasi/#respond</comments>
		
		<dc:creator><![CDATA[Halil Durmuş]]></dc:creator>
		<pubDate>Sat, 10 Oct 2020 15:22:41 +0000</pubDate>
				<category><![CDATA[Bilgisayar]]></category>
		<category><![CDATA[Genel]]></category>
		<category><![CDATA[Algoritma]]></category>
		<category><![CDATA[Bellman-Ford]]></category>
		<category><![CDATA[Time]]></category>
		<guid isPermaLink="false">https://www.halildurmus.com/?p=3822</guid>

					<description><![CDATA[<p>Bellman-Ford algoritmasının amacı, bir&#160;şekil (graph)&#160;üzerindeki, bir kaynaktan (source) bir hedefe(target ) giden en kısa yolu bulmaktır. Bir s ∈ V kaynağından tüm v ∈ V&#8217;lere bütün kısa yol uzunluklarını bulur. Yada bir negatif ağırlık çevrimi olduğunu saptar. Algoritma ağırlıklı şekiller (weighted graph) üzerinde çalışır ve bir anlamda&#160;Dijkstra algoritmasının&#160;iyileştirilmişi olarak düşünülebilir. Algoritma aslında Dijkstra algoritmasından daha [&#8230;]</p>
<p>The post <a href="https://www.halildurmus.com/2020/10/10/bellman-ford-algoritmasi/">Bellman-Ford Algoritması</a> appeared first on <a href="https://www.halildurmus.com">Halil Durmus</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Bellman-Ford algoritmasının amacı, bir&nbsp;şekil (graph)&nbsp;üzerindeki, bir kaynaktan (source) bir hedefe(target ) giden en kısa yolu bulmaktır. Bir s ∈ V kaynağından tüm v ∈  V&#8217;lere bütün kısa yol uzunluklarını bulur. Yada bir negatif ağırlık çevrimi olduğunu saptar. Algoritma ağırlıklı şekiller (weighted graph) üzerinde çalışır ve bir anlamda&nbsp;Dijkstra algoritmasının&nbsp;iyileştirilmişi olarak düşünülebilir.</p>



<p>Algoritma aslında Dijkstra algoritmasından daha kötü bir performansa sahiptir ancak graftaki ağırlıkların eksi(-) olması durumunda Dijkstra’nın tersine başarılı çalışır.</p>



<figure class="wp-block-image size-large"><img fetchpriority="high" decoding="async" width="622" height="311" src="https://www.halildurmus.com/wp-content/uploads/2020/09/495-Bellman-Ford.png" alt="Bellman-Ford algoritması Negatif ağırlık çevrimi graflar üzerinde çalışır." class="wp-image-3823" srcset="https://www.halildurmus.com/wp-content/uploads/2020/09/495-Bellman-Ford.png 622w, https://www.halildurmus.com/wp-content/uploads/2020/09/495-Bellman-Ford-300x150.png 300w" sizes="(max-width: 622px) 100vw, 622px" /></figure>



<p></p>



<ul class="wp-block-list"><li>Her düğüm için bir uzaklık tahmini oluşturulur.</li><li>Başlangıç olarak maliyet(s)=0 diğer düğümler için maliyet(u)= ∞ olarak atanır.</li><li>En az maliyetli yol hesaplanana kadar tüm kenarlar üzerinden güncelleme yapılır.</li></ul>



<div class="hcb_wrap"><pre class="prism undefined-numbers lang-plane"><code>BELLMAN-FORD(G,w,s) 
d[s] ← 0
for each v ∈V –{s}
   do d[v] ← ∞ 
for i ← 1 to |V| - 1
   do for each edge (u,v) ∈E
        do if d[v] &gt; d[u] + w(u, v) 
            then d[v] ← d[u] + w(u, v)
for each edge (u,v) ∈ E
   do if d[v] &gt; d[u] + w(u,v)
        then bir negatif ağırlık döngüsünün var olduğunu bildirin.
 return d[v] //  = δ(s, u), negatif ağırlıklı döngü yoksa</code></pre></div>



<p></p>



<p>Bu algoritmanın çalışmasını örnek bir şekil( graph ) üzerinden göstermeye çalışacağım. Bu gösterimin ardından Bellman-Ford Algoritmasının başarısını ve eksik taraflarını tartışabiliriz.</p>



<h4 class="wp-block-heading">Aşama 0</h4>



<figure class="wp-block-image size-large"><img decoding="async" width="662" height="362" src="https://www.halildurmus.com/wp-content/uploads/2020/09/487-Bellman-Ford-1-1.png" alt="Bellman-Ford algoritması aşama 0" class="wp-image-3825" srcset="https://www.halildurmus.com/wp-content/uploads/2020/09/487-Bellman-Ford-1-1.png 662w, https://www.halildurmus.com/wp-content/uploads/2020/09/487-Bellman-Ford-1-1-300x164.png 300w" sizes="(max-width: 662px) 100vw, 662px" /></figure>



<p></p>



<p>Algoritmanın çalışmasını yukarıdaki gibi eksi değerlere sahip bir şekil üzerinden anlamaya çalışalım.</p>



<p>Öncelikle düğümlere değer ataması yapılıyor. Başlangıç düğümüne 0, doğrudan erişilen düğümlere erişim değerleri ve erişilemeyen düğümlere&nbsp;∞&nbsp;sonsuz değeri atanıyor. Hedef düğüm olarak da E düğümünü tanımlayalım.</p>



<h4 class="wp-block-heading">Aşama 1</h4>



<figure class="wp-block-image size-large"><img decoding="async" width="662" height="362" src="https://www.halildurmus.com/wp-content/uploads/2020/09/488-Bellman-Ford-2.png" alt="Bellman-Ford algoritması aşama 1" class="wp-image-3826" srcset="https://www.halildurmus.com/wp-content/uploads/2020/09/488-Bellman-Ford-2.png 662w, https://www.halildurmus.com/wp-content/uploads/2020/09/488-Bellman-Ford-2-300x164.png 300w" sizes="(max-width: 662px) 100vw, 662px" /></figure>



<p></p>



<p>Bellman ford algoritması işte bu kenarları teker teker dolaşması itibariyle dijkstradan ayrılır. Sırayla yukarıdaki kenarları (Edges) dolaşır ve graftaki değerleri günceller.</p>



<p>İlk yineleme</p>



<p>B=AB 4, min(A,B)= 0-&gt; 0+4 = 4</p>



<h4 class="wp-block-heading">Aşama 2</h4>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="662" height="362" src="https://www.halildurmus.com/wp-content/uploads/2020/09/489-Bellman-Ford-3.png" alt="Bellman-Ford algoritması aşama 2
" class="wp-image-3827" srcset="https://www.halildurmus.com/wp-content/uploads/2020/09/489-Bellman-Ford-3.png 662w, https://www.halildurmus.com/wp-content/uploads/2020/09/489-Bellman-Ford-3-300x164.png 300w" sizes="auto, (max-width: 662px) 100vw, 662px" /></figure>



<p></p>



<p>C=AC 3, min(A,C)=0-&gt;0+3 =3</p>



<p>C= BC -2, min(B,C)= 4-&gt; 4-2 = 2</p>



<h4 class="wp-block-heading">Aşama 3</h4>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="662" height="362" src="https://www.halildurmus.com/wp-content/uploads/2020/09/490-Bellman-Ford-4.png" alt="Bellman-Ford algoritması aşama 3" class="wp-image-3828" srcset="https://www.halildurmus.com/wp-content/uploads/2020/09/490-Bellman-Ford-4.png 662w, https://www.halildurmus.com/wp-content/uploads/2020/09/490-Bellman-Ford-4-300x164.png 300w" sizes="auto, (max-width: 662px) 100vw, 662px" /></figure>



<p></p>



<p>D=BD 2, min(B,D)=4-&gt;4+2 =6</p>



<h4 class="wp-block-heading">Aşama 4</h4>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="662" height="362" src="https://www.halildurmus.com/wp-content/uploads/2020/09/491-Bellman-Ford-5.png" alt="Bellman-Ford algoritması aşama 4" class="wp-image-3829" srcset="https://www.halildurmus.com/wp-content/uploads/2020/09/491-Bellman-Ford-5.png 662w, https://www.halildurmus.com/wp-content/uploads/2020/09/491-Bellman-Ford-5-300x164.png 300w" sizes="auto, (max-width: 662px) 100vw, 662px" /></figure>



<p></p>



<p>E= BE -3, min(B,C)= 4-&gt; 4-3 = 1</p>



<p>1.Tur sonu</p>



<h4 class="wp-block-heading">Aşama 5</h4>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="662" height="362" src="https://www.halildurmus.com/wp-content/uploads/2020/09/492-Bellman-Ford-6.png" alt="Bellman-Ford algoritması aşama 5" class="wp-image-3830" srcset="https://www.halildurmus.com/wp-content/uploads/2020/09/492-Bellman-Ford-6.png 662w, https://www.halildurmus.com/wp-content/uploads/2020/09/492-Bellman-Ford-6-300x164.png 300w" sizes="auto, (max-width: 662px) 100vw, 662px" /></figure>



<p></p>



<p>D=CD 1, min(C,D)= 2-&gt; 2+1 =3</p>



<p>2.Tur Yineleme</p>



<h4 class="wp-block-heading">Aşama 6</h4>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="662" height="362" src="https://www.halildurmus.com/wp-content/uploads/2020/09/493-Bellman-Ford-7.png" alt="" class="wp-image-3831" srcset="https://www.halildurmus.com/wp-content/uploads/2020/09/493-Bellman-Ford-7.png 662w, https://www.halildurmus.com/wp-content/uploads/2020/09/493-Bellman-Ford-7-300x164.png 300w" sizes="auto, (max-width: 662px) 100vw, 662px" /></figure>



<p>Üçüncü &amp; Dördüncü Yineleme</p>



<h4 class="wp-block-heading">Aşama 7</h4>



<p><strong>Sonuç</strong>:</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="741" height="482" src="https://www.halildurmus.com/wp-content/uploads/2020/09/494-Bellman-Ford-8.png" alt="" class="wp-image-3832" srcset="https://www.halildurmus.com/wp-content/uploads/2020/09/494-Bellman-Ford-8.png 741w, https://www.halildurmus.com/wp-content/uploads/2020/09/494-Bellman-Ford-8-300x195.png 300w" sizes="auto, (max-width: 741px) 100vw, 741px" /></figure>



<p></p>



<p>Negatif ağırlıklar için geliştirişmiş genel ağırlıklar için Bellman-Ford algoritmasından bahsedildi ve çalışma zamanı <strong>O(VE)</strong>&#8216;ye mal olmaktaydı.</p>



<p><strong>Kaynakça: <a href="https://en.wikipedia.org/wiki/Bellman%E2%80%93Ford_algorithm">Wikipedia</a>, <a href="https://www.techiedelight.com/single-source-shortest-paths-bellman-ford-algorithm/">Techiedelight</a>,</strong> <a href="https://www.geeksforgeeks.org/bellman-ford-algorithm-dp-23/"><strong>Geeksforgeeks</strong></a></p>



<p><a href="https://www.youtube.com/watch?v=Ttezuzs39nk" target="_blank" rel="noreferrer noopener"><strong>MIT Introduction to Algorithms 6.046J/18.401J/SMA5503 Lecture 18 Prof.Erik Demaine</strong></a></p>
<p>The post <a href="https://www.halildurmus.com/2020/10/10/bellman-ford-algoritmasi/">Bellman-Ford Algoritması</a> appeared first on <a href="https://www.halildurmus.com">Halil Durmus</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.halildurmus.com/2020/10/10/bellman-ford-algoritmasi/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
