<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="../../xslt/mathml.xsl"?><html xmlns="http://www.w3.org/1999/xhtml" xmlns:m="http://www.w3.org/1998/Math/MathML">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>Graph Theory: Networking</title>
    <link rel="stylesheet" href="../../css/style_mozilla.css" type="text/css" media="screen"/>
  </head>
  <body>
    <div id="logobarleft">
      <a href="http://links.math.rpi.edu/">
        <img src="../../css/titlebar_left.gif" alt="Project Links Logo"/>
      </a>
    </div>
    <div id="logobarright">
      <img src="../../css/titlebar_right.jpg" alt="Artwork"/>
    </div>
    <div id="titlebar">Graph Theory: Networking</div>
    <div id="breadcrumbbar">
			Home &gt; Graph Theory: Networking
					&gt; Foundations
					&gt; Shortest Paths</div>
    <div id="sidebar">
      <div class="toolmenu1">
        <a href="banana.html" class="toolmenu1">Crib Sheet</a>
      </div>
      <br/>
      <div class="toolmenu2">
        <a href="banana.html" class="toolmenu2">Library</a>
      </div>
      <br/>
      <div class="toolmenu3">
        <a href="banana.html" class="toolmenu3">Help</a>
      </div>
      <br/>
      <div class="toolmenu4">
        <a href="banana.html" class="toolmenu4">Map</a>
      </div>
      <br/>
      <div class="toolmenu5">
        <a href="problemlist.xml" class="toolmenu5">Problem List</a>
      </div>
      <br/>
      <div class="toolmenu5">
        <a href="../index.html" class="toolmenu5">Module Home</a>
      </div>
      <br/>
      <div class="toolmenu6">
        <a href="http://links.math.rpi.edu/" class="toolmenu6">Links Home</a>
      </div>
      <br/>
      <br/>
      <div class="toc_topic">
        <a class="toc_link" href="page1.xml">Introduction</a>
      </div>
      <div class="toc_topic">
        <a class="toc_link" href="page2.xml">Objectives</a>
      </div>
      <div class="toc_topic">
        <a class="toc_link" href="page3.xml">Prerequisites</a>
      </div>
      <div class="toc_topic">
        <a class="toc_link" href="">Foundations</a>
      </div>
      <div class="toc_subtopic">
        <a class="toc_link" href="page4.xml">Directed Graphs</a>
      </div>
      <div class="toc_subtopic">
        <a class="toc_link" href="page6.xml">Definitions</a>
      </div>
      <div class="toc_subtopic">
        <a class="toc_link" href="page9.xml">Shortest Paths</a>
      </div>
      <div class="toc_topic">
        <a class="toc_link" href="">Shortest-Path Algorithms</a>
      </div>
      <div class="toc_subtopic">
        <a class="toc_link" href="page11.xml">Problem Variations</a>
      </div>
      <div class="toc_subtopic">
        <a class="toc_link" href="page13.xml">Dijkstra's Algorithm</a>
      </div>
      <div class="toc_subtopic">
        <a class="toc_link" href="page16.xml">Bellman-Ford Algorithm</a>
      </div>
      <div class="toc_topic">
        <a class="toc_link" href="">Routing</a>
      </div>
      <div class="toc_subtopic">
        <a class="toc_link" href="page19.xml">Overview</a>
      </div>
      <div class="toc_subtopic">
        <a class="toc_link" href="page21.xml">Designing A Routing Protocol</a>
      </div>
      <div class="toc_topic">
        <a class="toc_link" href="">Telephone Networks</a>
      </div>
      <div class="toc_subtopic">
        <a class="toc_link" href="page23.xml">Overview</a>
      </div>
      <div class="toc_subtopic">
        <a class="toc_link" href="page25.xml">Routing Strategies</a>
      </div>
      <div class="toc_subtopic">
        <a class="toc_link" href="page26.xml">Costs</a>
      </div>
      <div class="toc_subtopic">
        <a class="toc_link" href="page27.xml">DNHR</a>
      </div>
      <div class="toc_topic">
        <a class="toc_link" href="">The Internet</a>
      </div>
      <div class="toc_subtopic">
        <a class="toc_link" href="page29.xml">Overview</a>
      </div>
      <div class="toc_subtopic">
        <a class="toc_link" href="page30.xml">Distance-Vector Routing</a>
      </div>
      <div class="toc_subtopic">
        <a class="toc_link" href="page33.xml">Link-State Routing</a>
      </div>
      <div class="toc_subtopic">
        <a class="toc_link" href="page37.xml">What's Next?</a>
      </div>
    </div>
    <div id="sectionbar">
      <div id="spacerright" class="spacerright">-</div>
      <div>
        <a href="page9.xml" class="sectionshighlighted">concepts</a>
      </div>
      <div>
        <a href="" class="sectionsgrayed">discover</a>
      </div>
      <div>
        <a href="" class="sectionsgrayed">apply</a>
      </div>
      <div>
        <a href="page10.xml" class="sections">collaborate</a>
      </div>
      <div>
        <a href="" class="sectionsgrayed">practice</a>
      </div>
      <div id="spacerleft" class="spacerleft">-</div>
    </div>
    <div id="content"><h1>Shortest Paths</h1>
				<p>
				Our next step in generalizing the notion of a graph is to consider
				<i>weighted</i> graphs, for which every edge is
				associated with a real number, called a <i>weight</i>
				(or <i>cost</i>, or <i>length</i>) of the
				edge. Weights can be negative or nonnegative.
				</p>
				
				<p>
				This generalization prompts us to modify our definition of the length
				of a walk, which we are going to call <i>the weight of a	walk</i>
				in order to differentiate it from the notion of the
				number of edges in a walk.
				</p>
				<p>
				Here is the formal definition of the weight of a walk:
				</p>
				<p>
				Given a weighted directed graph
				<m:math>
					<m:mi>G</m:mi>
					<m:mo>⁡</m:mo>
					<m:mfenced>
						<m:mi>V</m:mi>
						<m:mi>E</m:mi>
					</m:mfenced>
				</m:math>
				with a weight function 
				<m:math>
					<m:mi>w</m:mi>
					<m:mo>:</m:mo>
					<m:mi>E</m:mi>
					<m:mo>→</m:mo>
					<m:mi>R</m:mi>
				</m:math>,
				the weight
				<m:math>
					<m:mi>w</m:mi>
					<m:mo>⁡</m:mo>
					<m:mfenced>
						<m:mi>P</m:mi>
					</m:mfenced>
				</m:math>
				of a walk
				</p>
				<p><div class="equation" align="center">
				<m:math>
					<m:mi>P</m:mi>
					<m:mo>=</m:mo>
					<m:mfenced>
						<m:msub>
							<m:mi>v</m:mi>
							<m:mn>0</m:mn>
						</m:msub>
						<m:msub>
							<m:mi>e</m:mi>
							<m:mn>0</m:mn>
						</m:msub>
						<m:msub>
							<m:mi>v</m:mi>
							<m:mn>1</m:mn>
						</m:msub>
						<m:msub>
							<m:mi>e</m:mi>
							<m:mn>1</m:mn>
						</m:msub>
						<m:mo>…</m:mo>
						<m:msub>
							<m:mi>v</m:mi>
							<m:mrow>
								<m:mi>k</m:mi>
								<m:mo>-</m:mo>
								<m:mn>1</m:mn>
							</m:mrow>
						</m:msub>
						<m:msub>
							<m:mi>e</m:mi>
							<m:mrow>
								<m:mi>k</m:mi>
								<m:mo>-</m:mo>
								<m:mn>1</m:mn>
							</m:mrow>
						</m:msub>
						<m:msub>
							<m:mi>v</m:mi>
							<m:mi>k</m:mi>
						</m:msub>
					</m:mfenced>
				</m:math>
				<br/><b><i>Equation
				1</i></b></div></p>
				<p>
				is defined as the sum
				</p>
				<p><div class="equation" align="center">
				<m:math>
					<m:mi>w</m:mi>
					<m:mfenced>
						<m:mi>P</m:mi>
					</m:mfenced>
					<m:mo>=</m:mo>
					<m:munderover>
						<m:mo lspace="thinmathspace" rspace="thinmathspace">∑</m:mo>
						<m:mrow>
							<m:mi>i</m:mi>
							<m:mo>=</m:mo>
							<m:mn>0</m:mn>
						</m:mrow>
						<m:mrow>
							<m:mi>k</m:mi>
							<m:mo>-</m:mo>
							<m:mn>1</m:mn>
						</m:mrow>
					</m:munderover>
					<m:mi>w</m:mi>
					<m:mfenced>
						<m:msub>
							<m:mi>e</m:mi>
							<m:mi>i</m:mi>
						</m:msub>
					</m:mfenced>
					<m:mtext>.</m:mtext>
				</m:math>
				<br/><b><i>Equation
				2</i></b></div></p>
				<p>
				The distance
				<m:math>
					<m:mi>δ</m:mi>
					<m:mfenced>
						<m:mi>u</m:mi>
						<m:mi>v</m:mi>
					</m:mfenced>
				</m:math>
				from <m:math><m:mi>u</m:mi></m:math> to <m:math><m:mi>v</m:mi></m:math> is defined by
				</p>
				<p><div class="equation" align="center">
				
				<m:math>
					<m:mi>δ</m:mi>
					<m:mfenced>
						<m:mi>u</m:mi>
						<m:mi>v</m:mi>
					</m:mfenced>
					<m:mo>=</m:mo>
					<m:mn>∞</m:mn>
				</m:math>
				<br/><b><i>Equation
				3</i></b></div></p>
				<p>
				if no directed walk from
				<m:math><m:mi>u</m:mi></m:math>
				to
				<m:math><m:mi>v</m:mi></m:math>
				exists
				<m:math>
					<m:mrow>
						<m:mi>w</m:mi>
						<m:mo>⁡</m:mo>
						<m:mfenced>
							<m:mi>P</m:mi>
						</m:mfenced>
					</m:mrow>
				</m:math>
				<m:math><m:mi>P</m:mi></m:math>
				is a directed walk from 
				<m:math><m:mi>u</m:mi></m:math>
				to
				<m:math><m:mi>v</m:mi></m:math>
				</p>
			</div>
    <div id="nav">
      <a href="page8.xml" class="nav">back</a>
      <a href="page10.xml" class="nav">next</a>
    </div>
    <div class="copyright">
			Copyright 1999
			Rensselaer Polytechnic Institute. All Rights Reserved.
		</div>
  </body>
</html>
