<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>Mikeem's Favorite Links on algorithm from Diigo</title>
    <link>http://www.diigo.com/user/Mikeem/algorithm</link>
    <pubDate>Mon, 17 Dec 2007 01:46:51 -0000</pubDate>
    <lastBuildDate>Mon, 17 Dec 2007 01:46:51 -0000</lastBuildDate>
    <item>
      <title>Dijkstra's Algorithm</title>
      <link>http://www.cs.usask.ca/resources/tutorials/csconcepts/1999_8/tutorial/advanced/dijkstra/dijkstra.html</link>
      <description>&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Tags:&lt;/strong&gt; &lt;a href='http://www.diigo.com/user/mikeem/algorithm' rel='tag'&gt;algorithm&lt;/a&gt; &lt;a href='http://www.diigo.com/user/mikeem/exam' rel='tag'&gt;exam&lt;/a&gt; &lt;a href='http://www.diigo.com/user/mikeem/maths' rel='tag'&gt;maths&lt;/a&gt; &lt;/p&gt;&lt;p&gt;&lt;strong&gt;Posted by:&lt;/strong&gt; &lt;a href='http://www.diigo.com/user/mikeem'&gt;mikeem&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Mon, 17 Dec 2007 01:46:51 -0000</pubDate>
    </item>
    <item>
      <title>THE CHINESE POSTMAN PROBLEM - ALGORITHM FOR NETWORKS INVOLVING ODD VERTICES WITH DISCUSSION</title>
      <link>http://people.bath.ac.uk/tjs20/oddnetdisc.htm</link>
      <description>&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Highlights and Sticky Notes:&lt;/strong&gt;&lt;p&gt;&lt;div class=&quot;content&quot;&gt;&lt;td&gt;&lt;font face=&quot;Arial, Helvetica, sans-serif&quot;&gt;&lt;/font&gt;&lt;p&gt;Note also that by considering this algorithm, it is relatively easy to see how to modify Fleury’s algorithm for finding an Euler circuit in a graph with two odd vertices if it is necessary to return to the starting vertex.  We would simply construct an extra path between the two vertices, and this path would represent the extra distance that we would need to travel in order to be able to go back to the start.  Clearly in this case the solution would no longer be a semi-Eulerian circuit (nor would it be an Eulerian circuit, as we are effectively traversing a part of the network twice to accommodate the desire to return to the starting point). &lt;/p&gt;

&lt;/td&gt;
&lt;td valign=&quot;top&quot;&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;
  &lt;p&gt;&amp;nbsp;&lt;/p&gt;
  &lt;p&gt;&amp;nbsp;&lt;/p&gt;
  &lt;p&gt;&amp;nbsp;&lt;/p&gt;
  &lt;p&gt;&amp;nbsp;&lt;/p&gt;
  &lt;p&gt;&amp;nbsp;&lt;/p&gt;  
  &lt;p&gt;&amp;nbsp;&lt;/p&gt;
  &lt;p&gt;&lt;/p&gt;&lt;/td&gt;&lt;/div&gt;&lt;/p&gt;&lt;p&gt;&lt;div class=&quot;content&quot;&gt;We can see from the way that odd vertices are paired in the algorithm that the minimum circuit for any network will always have a length of less than twice the sum of all the weightings on the graph.  This is because each edge in the network must be traversed once, by definition.  Any extra parts added onto the route, i.e. repeated edges, will minimise the total distance from considering all possible pairings of odd vertices.  As the number of odd vertices must be less than or equal to the number of vertices in total, then the optimal way in which this is done means that the extra length added must be less than the sum of the lengths of the entire original network.  Thus, a relatively good route will always exist given even the most difficult network (one with only odd vertices).&lt;/div&gt;&lt;/p&gt;&lt;p&gt;&lt;div class=&quot;content&quot;&gt;If the graph has more than two vertices of odd degree, we will have to retrace some of the edges in order to traverse all edges at least once, which makes sense.  This assumes that we wish to finish up at the same vertex that we started out from.&lt;/div&gt;&lt;/p&gt;&lt;p&gt;&lt;div class=&quot;content&quot;&gt;By applying this algorithm, we are effectively converting the vertices of odd degree to even degree by adding additional edges.  The process of eliminating odd vertices by adding additional edges is called “Eulerising” the graph.  Once the additional edges have been added in, we can simply apply Fleury’s algorithm to the modified network to obtain an optimal solution.&lt;/div&gt;&lt;/p&gt;&lt;p&gt;&lt;div class=&quot;content&quot;&gt;3) For each set of pairings, for each pairing, find the shortest route you need to travel to get from one vertex in the pairing to the other.  Hence, add up the total distance you need to travel for each set of possible pairings.&lt;/div&gt;&lt;/p&gt;&lt;p&gt;&lt;div class=&quot;content&quot;&gt;4)	Choose the pairing with the minimum total distance and repeat these edges in the network, i.e. makes the associated vertices have an even degree.  Note: there may be many different routes that can be constructed, all of which take the same minimum distance.&lt;/div&gt;&lt;/p&gt;&lt;p&gt;&lt;div class=&quot;content&quot;&gt;2) In order to make the network Eulerian, find possible all possible sets of pairings of odd vertices in order to make them of even degree so that no odd vertices are left in the network.&lt;/div&gt;&lt;/p&gt;&lt;p&gt;&lt;div class=&quot;content&quot;&gt;1) List all odd vertices in the network.  There will be an even number of these.&lt;/div&gt;&lt;/p&gt;&lt;p&gt;&lt;div class=&quot;content&quot;&gt;It may well be the case that the network we are dealing with does indeed contain odd vertices, and where we wish to return to our starting vertex.  In this circumstance, we require a different algorithm to obtain a solution.&lt;/div&gt;&lt;/p&gt;&lt;p&gt;&lt;p&gt;&lt;strong&gt;Tags:&lt;/strong&gt; &lt;a href='http://www.diigo.com/user/mikeem/algorithm' rel='tag'&gt;algorithm&lt;/a&gt; &lt;a href='http://www.diigo.com/user/mikeem/exam' rel='tag'&gt;exam&lt;/a&gt; &lt;a href='http://www.diigo.com/user/mikeem/maths' rel='tag'&gt;maths&lt;/a&gt; &lt;a href='http://www.diigo.com/user/mikeem/postman' rel='tag'&gt;postman&lt;/a&gt; &lt;/p&gt;&lt;p&gt;&lt;strong&gt;Posted by:&lt;/strong&gt; &lt;a href='http://www.diigo.com/user/mikeem'&gt;mikeem&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Sun, 16 Dec 2007 23:08:21 -0000</pubDate>
    </item>
    <item>
      <title>THE CHINESE POSTMAN PROBLEM - MODIFICATION OF FLEURY'S ALGORITHM</title>
      <link>http://people.bath.ac.uk/tjs20/modfleuryalgorithm.htm</link>
      <description>&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Highlights and Sticky Notes:&lt;/strong&gt;&lt;p&gt;&lt;div class=&quot;content&quot;&gt;This is what we would have expected from our earlier analysis, and what the algorithm is designed to do, so we have applied it correctly. The semi-Eulerian circuit achieved is shown in green on the diagram below.&lt;/div&gt;&lt;/p&gt;&lt;p&gt;&lt;div class=&quot;content&quot;&gt;&lt;img title=&quot;&quot; src=&quot;http://people.bath.ac.uk/tjs20/images/modfleuryalgorithm2.jpg&quot; alt=&quot;&quot; /&gt;&lt;/div&gt;&lt;/p&gt;&lt;p&gt;&lt;div class=&quot;content&quot;&gt;&lt;p&gt; We must start at one of the odd vertices, let us say D. &lt;/p&gt;
&lt;p&gt;•&amp;nbsp; From here, we can select to go to any of the vertices E or G. Let us select G, as shown in the diagram. &lt;/p&gt;
&lt;p&gt;•&amp;nbsp; Then we will traverse edge GC. &lt;/p&gt;
&lt;p&gt;•&amp;nbsp; Next, we are forced to select CB, even though it is a bridge for the remaining edges at this stage. &lt;/p&gt;
&lt;p&gt;•&amp;nbsp; From here, we will go to G, and then back to D (allowed as GD is not a bridge for remaining edges). &lt;/p&gt;
&lt;p&gt;•&amp;nbsp; Then we will traverse the edge DE (although we know we must finish at vertex E, this is allowed, as DE is not a bridge for remaining arcs, and it is clear from the diagram that we are able to return later as there are three edges incident upon E). &lt;/p&gt;
&lt;p&gt;•&amp;nbsp; Continuing to apply the algorithm, we get EG, GF, FA, AB. &lt;/p&gt;
&lt;p&gt;•&amp;nbsp; At B, we have to select edge BF, because it is the only remaining edge leading out from B, although it is a bridge. &lt;/p&gt;
&lt;p&gt;•&amp;nbsp; Finally, we take edge FE to finish at E, the other odd vertex.&lt;/p&gt;&lt;/div&gt;&lt;/p&gt;&lt;p&gt;&lt;div class=&quot;content&quot;&gt;&lt;img title=&quot;&quot; src=&quot;http://people.bath.ac.uk/tjs20/images/modfleuryalgorithm1.jpg&quot; alt=&quot;&quot; /&gt;&lt;/div&gt;&lt;/p&gt;&lt;p&gt;&lt;div class=&quot;content&quot;&gt;&lt;p&gt; Use Fleury's Algorithm just as stated above EXCEPT always start at one of the odd vertices.&lt;/p&gt;
&lt;p&gt;The path produced by this modification of Fleury's algorithm is always a semi-Eulerian cycle for the reasons discussed previously.&lt;/p&gt;&lt;/div&gt;&lt;/p&gt;&lt;p&gt;&lt;p&gt;&lt;strong&gt;Tags:&lt;/strong&gt; &lt;a href='http://www.diigo.com/user/mikeem/algorithm' rel='tag'&gt;algorithm&lt;/a&gt; &lt;a href='http://www.diigo.com/user/mikeem/exam' rel='tag'&gt;exam&lt;/a&gt; &lt;a href='http://www.diigo.com/user/mikeem/maths' rel='tag'&gt;maths&lt;/a&gt; &lt;a href='http://www.diigo.com/user/mikeem/postman' rel='tag'&gt;postman&lt;/a&gt; &lt;/p&gt;&lt;p&gt;&lt;strong&gt;Posted by:&lt;/strong&gt; &lt;a href='http://www.diigo.com/user/mikeem'&gt;mikeem&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Sun, 16 Dec 2007 23:00:59 -0000</pubDate>
    </item>
    <item>
      <title>THE CHINESE POSTMAN PROBLEM - FLEURY'S ALGORITHM</title>
      <link>http://people.bath.ac.uk/tjs20/fleuryalgorithm.htm</link>
      <description>&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Highlights and Sticky Notes:&lt;/strong&gt;&lt;p&gt;&lt;div class=&quot;content&quot;&gt;&lt;img title=&quot;&quot; src=&quot;http://people.bath.ac.uk/tjs20/images/fleuryalgorithm2.jpg&quot; alt=&quot;&quot; /&gt;&lt;/div&gt;&lt;/p&gt;&lt;p&gt;&lt;div class=&quot;content&quot;&gt;&lt;p&gt; At the next stage, it would appear that I have three choices of arc to travel along. However, if we consider only the remaining edges that are not yet included in the solution, we can see that FA is now a bridge, and so we must not select this choice (we can now see why this rule works now; we would be “trapped” at A if we selected the edge FA, having to include the same arc twice). We will choose FE arbitrarily from the remaining options. &lt;/p&gt;
&lt;p&gt;•&amp;nbsp; We will now continue our circuit without complication as there are no bridges for remaining arcs, using edges ED, DG, GD. &lt;/p&gt;
&lt;p&gt;•&amp;nbsp; Note now that we are at D that we only have one arc choice, DE. This is a bridge for remaining edges, and so normally would not be allowed. However, as it is the only option, we must select it, as the algorithm states. This will happen many times throughout the remainder of the application of the algorithm. Each time, we are leaving a vertex for the final time. &lt;/p&gt;
&lt;p&gt;•&amp;nbsp; Finishing off the algorithm with the bridge constraint gives the inclusion of edges EG, GC, CB, BG, GF, FA. &lt;/p&gt;
&lt;p&gt;•&amp;nbsp; Thus, we have an Euler circuit through our network as required. This has been marked on the original network diagram shown below in green. &lt;/p&gt;

&lt;p align=&quot;center&quot;&gt;&lt;img ilo-full-src=&quot;http://people.bath.ac.uk/tjs20/images/fleuryalgorithm2.jpg&quot; src=&quot;images/fleuryalgorithm2.jpg&quot; height=&quot;198&quot; width=&quot;268&quot; /&gt;&lt;/p&gt;
&lt;p&gt;This algorithm can be applied to any network only containing vertices of an even degree.&lt;/p&gt;&lt;/div&gt;&lt;/p&gt;&lt;p&gt;&lt;div class=&quot;content&quot;&gt;&lt;p&gt;Following the algorithm, then: &lt;/p&gt;
&lt;p&gt;•&amp;nbsp; I will arbitrarily choose A to be my starting vertex. &lt;/p&gt;
&lt;p&gt;•&amp;nbsp; From here, I have a choice of which edge to travel along, as neither the edges AB nor AF are bridges. I will select AB. &lt;/p&gt;
&lt;p&gt;•&amp;nbsp; Next, I will choose to travel to F via the edge BF, which is again valid under the bridge constraint.&lt;/p&gt;&lt;/div&gt;&lt;/p&gt;&lt;p&gt;&lt;div class=&quot;content&quot;&gt;Let us see an example of this algorithm at work. Here, I have invented a network that has seven vertices, all of which are of an even order. It therefore satisfies the conditions for Fleury's algorithm to work.&lt;/div&gt;&lt;/p&gt;&lt;p&gt;&lt;div class=&quot;content&quot;&gt;&lt;img title=&quot;&quot; src=&quot;http://people.bath.ac.uk/tjs20/images/fleuryalgorithm1.jpg&quot; alt=&quot;&quot; /&gt;&lt;/div&gt;&lt;/p&gt;&lt;p&gt;&lt;div class=&quot;content&quot;&gt;Here, the second point is effectively saying that you should not go back to the starting vertex until you have to, i.e. right at the end of the construction of the path, as required.&lt;/div&gt;&lt;/p&gt;&lt;p&gt;&lt;div class=&quot;content&quot;&gt;&lt;p&gt;The algorithm is as follows: &lt;/p&gt;

&lt;p&gt;•&amp;nbsp; Pick any vertex as a starting point. &lt;/p&gt;
&lt;!-- This is the html code for a bullet-point --&gt;
&lt;p&gt;•&amp;nbsp; Marking your path as you move from vertex to vertex, travel along any edges you wish, except do not travel along an edge that is a bridge for the graph formed by the edges that have yet to be traversed unless you &lt;em&gt;have to &lt;/em&gt;. &lt;/p&gt;
&lt;!-- The em tag denotes that text within it should be italic --&gt;
&lt;p&gt;•&amp;nbsp; Continue until you return to your starting point.&lt;/p&gt;&lt;/div&gt;&lt;/p&gt;&lt;p&gt;&lt;p&gt;&lt;strong&gt;Tags:&lt;/strong&gt; &lt;a href='http://www.diigo.com/user/mikeem/algorithm' rel='tag'&gt;algorithm&lt;/a&gt; &lt;a href='http://www.diigo.com/user/mikeem/exam' rel='tag'&gt;exam&lt;/a&gt; &lt;a href='http://www.diigo.com/user/mikeem/maths' rel='tag'&gt;maths&lt;/a&gt; &lt;a href='http://www.diigo.com/user/mikeem/postman' rel='tag'&gt;postman&lt;/a&gt; &lt;/p&gt;&lt;p&gt;&lt;strong&gt;Posted by:&lt;/strong&gt; &lt;a href='http://www.diigo.com/user/mikeem'&gt;mikeem&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Sun, 16 Dec 2007 22:44:51 -0000</pubDate>
    </item>
    <ttl>60</ttl>
  </channel>
</rss>