<?xml version="1.0" encoding="UTF-8"?>
<Worksheet>
<Version major="2015" minor="1"/>
<Label-Scheme value="2" prefix=""/>
<View-Properties presentation="false" autoexpanding_sections="true" UserProfileName="Maple Default Profile" NumericFormat-ApplyInteger="true" NumericFormat-ApplyRational="true" NumericFormat-ApplyExponent="false">
<Hide name="Group Range"/>
<Hide name="Section Range"/>
</View-Properties>
<MapleNet-Properties elisiondigitsbefore="100" labelling="true" indentamount="4" elisiontermsthreshold="10000" ansi="false" errorbreak="1" useclientjvm="true" echo="1" imaginaryunit="I" labelwidth="20" unitattributes="&quot;fontweight&quot; = &quot;bold&quot;" contextmenusize="automatic" plotdriver="opengl" elisiondigitsafter="100" plotoutput="terminal" helpbrowser="standard" rtablesize="10" elisiontermsbefore="100" elisiondigitsthreshold="10000" typesetting="standard" plotdevice="inline" verboseproc="1" showassumed="1" quiet="false" errorcursor="false" longdelim="true" plotoptions="" elisiontermsafter="100" screenwidth="79" preplot="" prettyprint="3" displayprecision="-1" screenpixelheight="768" warnlevel="3" screenheight="25" latexwidth="8.0" postplot="" prompt="&gt; " ShowLabels="true"/>
<Styles>
<Font name="Ordered List 1" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Annotation Text" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Ordered List 2" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Ordered List 3" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Ordered List 4" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Ordered List 5" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Author" background="[0,0,0]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Annotation Title" background="[255,255,255]" bold="true" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="18" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Warning" background="[255,255,255]" bold="false" executable="false" family="Monospaced" foreground="[0,0,255]" italic="false" opaque="false" readonly="true" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Caption Reference" background="[255,255,255]" bold="true" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Maple Input Placeholder" background="[255,255,255]" bold="true" executable="true" family="Monospaced" foreground="[200,0,200]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="true"/>
<Font name="Maple Plot" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Code" background="[255,255,255]" bold="false" executable="false" family="Courier New" foreground="[255,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Line Printed Output" background="[0,0,0]" bold="false" executable="false" family="Monospaced" foreground="[0,0,255]" italic="false" opaque="false" readonly="true" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Text Output" background="[255,255,255]" bold="false" executable="false" family="Monospaced" foreground="[0,0,255]" italic="false" opaque="false" readonly="true" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Diagnostic" background="[255,255,255]" bold="false" executable="false" family="Monospaced" foreground="[40,120,40]" italic="false" opaque="false" readonly="true" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="2D Inert Output" background="[255,255,255]" bold="false" executable="true" family="Times New Roman" foreground="[144,144,144]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Normal" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Hyperlink" background="[255,255,255]" bold="false" executable="false" family="Serif" foreground="[0,128,128]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="true" placeholder="false"/>
<Font name="Maple Output" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Dash Item" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="2D Math" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Maple Input" background="[0,0,0]" bold="true" executable="true" family="Monospaced" foreground="[255,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="2D Output" background="[0,0,0]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,255]" italic="false" opaque="false" readonly="true" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="2D Input" background="[255,255,255]" bold="false" executable="true" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="HyperlinkError" background="[255,255,255]" bold="false" executable="false" family="Courier New" foreground="[255,0,255]" italic="false" opaque="false" readonly="true" size="12" subscript="false" superscript="false" underline="true" placeholder="false"/>
<Font name="Header and Footer" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="10" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Error" background="[255,255,255]" bold="false" executable="false" family="Monospaced" foreground="[255,0,255]" italic="false" opaque="false" readonly="true" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Title" background="[0,0,0]" bold="true" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="18" subscript="false" superscript="false" underline="true" placeholder="false"/>
<Font name="Page Number" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="10" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Heading 1" background="[0,0,0]" bold="true" executable="false" family="Serif" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="18" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Text" background="[0,0,0]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Bullet Item" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Heading 4" background="[255,255,255]" bold="false" executable="false" family="Serif" foreground="[0,0,0]" italic="true" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Equation Label" background="[255,255,255]" bold="true" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Heading 3" background="[255,255,255]" bold="true" executable="false" family="Serif" foreground="[0,0,0]" italic="true" opaque="false" readonly="false" size="14" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Heading 2" background="[255,255,255]" bold="true" executable="false" family="Serif" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="16" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="HyperlinkWarning" background="[255,255,255]" bold="false" executable="false" family="Courier New" foreground="[0,0,255]" italic="false" opaque="false" readonly="true" size="12" subscript="false" superscript="false" underline="true" placeholder="false"/>
<Font name="Dictionary Hyperlink" background="[255,255,255]" bold="false" executable="false" family="Serif" foreground="[147,0,15]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="true" placeholder="false"/>
<Font name="Atomic Variable" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[175,0,175]" italic="true" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Caption Text" background="[255,255,255]" bold="true" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="List Item" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Layout name="Ordered List 1" alignment="left" bullet="numeric" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="3" spacebelow="3" linebreak="space" pagebreak-before="false" initial="-1" bulletsuffix=""/>
<Layout name="Ordered List 2" alignment="left" bullet="alphabetic" firstindent="0" leftmargin="36" rightmargin="0" linespacing="0.0" spaceabove="3" spacebelow="3" linebreak="space" pagebreak-before="false" initial="-1" bulletsuffix=""/>
<Layout name="Ordered List 3" alignment="left" bullet="roman" firstindent="0" leftmargin="72" rightmargin="0" linespacing="0.0" spaceabove="3" spacebelow="3" linebreak="space" pagebreak-before="false" initial="-1" bulletsuffix=""/>
<Layout name="Ordered List 4" alignment="left" bullet="ALPHABETIC" firstindent="0" leftmargin="108" rightmargin="0" linespacing="0.0" spaceabove="3" spacebelow="3" linebreak="space" pagebreak-before="false" initial="-1" bulletsuffix=""/>
<Layout name="Ordered List 5" alignment="left" bullet="ROMAN" firstindent="0" leftmargin="144" rightmargin="0" linespacing="0.0" spaceabove="3" spacebelow="3" linebreak="space" pagebreak-before="false" initial="-1" bulletsuffix=""/>
<Layout name="Author" alignment="centred" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="8" spacebelow="8" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Warning" alignment="left" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="0" spacebelow="0" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Annotation Title" alignment="centred" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="12" spacebelow="12" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Maple Plot" alignment="centred" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="0" spacebelow="0" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Line Printed Output" alignment="left" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="0" spacebelow="0" linebreak="any" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Text Output" alignment="left" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="0" spacebelow="0" linebreak="newline" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Diagnostic" alignment="left" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="0" spacebelow="0" linebreak="any" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Normal" alignment="left" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="0" spacebelow="0" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Maple Output" alignment="centred" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.5" spaceabove="0" spacebelow="0" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Dash Item" alignment="left" bullet="dash" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="3" spacebelow="3" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="HyperlinkError" alignment="left" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="0" spacebelow="0" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Error" alignment="left" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="0" spacebelow="0" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Title" alignment="centred" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="12" spacebelow="12" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Heading 1" alignment="left" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="8" spacebelow="4" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Bullet Item" alignment="left" bullet="dot" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="3" spacebelow="3" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Heading 4" alignment="left" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="0" spacebelow="0" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Heading 3" alignment="left" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="0" spacebelow="0" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Heading 2" alignment="left" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="8" spacebelow="2" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="HyperlinkWarning" alignment="left" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="0" spacebelow="0" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="List Item" alignment="left" bullet="indent" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="3" spacebelow="3" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Pencil-style name="Pencil 5" pen-color="[255,0,0]" pen-height="5.0" pen-width="5.0" pen-opacity="1.0"/>
<Pencil-style name="Pencil 4" pen-color="[0,0,255]" pen-height="3.0" pen-width="3.0" pen-opacity="1.0"/>
<Pencil-style name="Pencil 3" pen-color="[0,0,0]" pen-height="3.0" pen-width="3.0" pen-opacity="1.0"/>
<Pencil-style name="Pencil 2" pen-color="[0,0,255]" pen-height="1.0" pen-width="1.0" pen-opacity="1.0"/>
<Pencil-style name="Pencil 1" pen-color="[0,0,0]" pen-height="1.0" pen-width="1.0" pen-opacity="1.0"/>
<Highlighter-style name="Highlighter 2" pen-color="[255,204,0]" pen-height="14.0" pen-width="14.0" pen-opacity="0.8"/>
<Highlighter-style name="Highlighter 1" pen-color="[255,153,255]" pen-height="12.0" pen-width="8.0" pen-opacity="0.8"/>
<Highlighter-style name="Highlighter 4" pen-color="[0,255,255]" pen-height="32.0" pen-width="32.0" pen-opacity="0.8"/>
<Highlighter-style name="Highlighter 3" pen-color="[51,255,0]" pen-height="24.0" pen-width="24.0" pen-opacity="0.8"/>
<Highlighter-style name="Highlighter 5" pen-color="[255,255,0]" pen-height="48.0" pen-width="48.0" pen-opacity="0.8"/>
</Styles>
<Startup-Code startupcode=""/>
<Task-table>
    <Task-category name="&lt;default&gt;"/>
</Task-table>
<Annotation-table>
    <Annotation-category name="&lt;default&gt;"/>
</Annotation-table>
<Task/>
<Group labelreference="L26" drawlabel="true">
<Input>
<Text-field style="Text" layout="Normal" alignment="centred"></Text-field>
</Input>
</Group>
<Group labelreference="L3">
<Input>
<Text-field style="Title" size="20" family="Arial" underline="false" layout="Title" spacebelow="1"><Font family="Arial" underline="false" size="20">Dijkstra's Shortest Path Algorithm</Font></Text-field>
<Text-field style="Title" size="16" family="Arial" underline="false" layout="Title" spaceabove="0"><Font family="Arial" underline="false" size="16">with step-by-step execution</Font></Text-field>
<Text-field style="Author" layout="Author">Fernando Michel Tavera
Student at National Autonomous University of Mexico (UNAM)
Mexico
e-mail: fernando_michel@ciencias.unam.mx</Text-field>
<Text-field style="Author" layout="Author"><Font encoding="UTF-8">Social service project director: Dr. Patricia Esperanza Balderas Ca\303\261as
</Font>Full time professor at National Autonomous University of Mexico (UNAM)
Mexico
e-mail: balderas.patricia@gmail.com</Text-field>
</Input>
</Group>
<Section collapsed="false" MultipleChoiceAnswerIndex="-1" MultipleChoiceRandomizeChoices="false" TrueFalseAnswerIndex="-1" EssayAnswerRows="5" EssayAnswerColumns="60"><Title>
<Text-field style="Heading 1" layout="Heading 1">Introduction</Text-field></Title>
<Text-field style="Text" layout="Normal">Dijkstra's Shortest Path Algorithm is a well known solution to the Shortest Paths problem, which consists in finding the shortest path </Text-field>
<Text-field style="Text" layout="Normal">(in terms of arc weights) from an initial vertex <Font italic="true">r </Font>to each other vertex in a directed weighted graph with nonnegative weights</Text-field>
<Text-field style="Text" layout="Normal">In this work we utilize the definition of the Dijkstra's algorithm given by Cook et. al. (see References) which is as follows:
    &quot;Initialize <Font italic="true">y</Font>, <Font italic="true">p</Font>;
      set <Font italic="true">S</Font> = <Font italic="true">V;</Font>
      While <Font encoding="UTF-8" italic="true">S \342\211\240</Font><Font encoding="UTF-8"> \342\210\205</Font>
         Choose <Font italic="true">v</Font><Font encoding="UTF-8"> \342\210\210</Font><Font italic="true">S</Font> with <Font italic="true">y</Font>(<Font italic="true">v</Font>) minimum;
         Delete <Font italic="true">v</Font> form <Font italic="true">S</Font>;
         Scan <Font italic="true">v</Font>.&quot;</Text-field>
<Text-field style="Text" layout="Normal">where: <Font italic="true">y</Font> is a set of <Font italic="true">y</Font>(<Font italic="true">v</Font>), the size of the shortest path found so far from <Font italic="true">r</Font> to <Font italic="true">v</Font>, for each vertex <Font italic="true">v</Font>;</Text-field>
<Text-field style="Text" layout="Normal">           <Font italic="true">p</Font> is a set of the 'parent vertex' <Font italic="true">p</Font>(<Font italic="true">v</Font>)of each vertex <Font italic="true">v</Font>, that is to say the vertex prior to <Font italic="true">v</Font> in the shortest path from <Font italic="true">r</Font> to <Font italic="true">v</Font> found so far;</Text-field>
<Text-field style="Text" layout="Normal">          Initialize means setting <Font italic="true">y</Font>(<Font italic="true">v</Font><Font encoding="UTF-8">) = \342\210\236 and </Font><Font italic="true">p</Font>(<Font italic="true">v</Font>) = null for each for each vertex <Font italic="true">v</Font> except r, and y(r) = 0 (the value of p(r) is not important);</Text-field>
<Text-field style="Text" layout="Normal">          <Font italic="true">S</Font> is a set of vertices that have not yet been scanned, and <Font italic="true">V</Font> is the set of all the vertices in the graph;
          Scanning a vertex <Font italic="true">u</Font> means verifying, for every arc <Font italic="true">a</Font>=(<Font italic="true">u</Font>,<Font italic="true">v</Font>) with weight <Font italic="true">w</Font>, that <Font italic="true">y</Font>(<Font italic="true">u</Font>) + <Font italic="true">w</Font><Font encoding="UTF-8"> \342\211\245</Font> <Font italic="true">y</Font>(<Font italic="true">v</Font>) (that is <Font italic="true">a</Font> is &quot;correct&quot;), and otherwise correct it.</Text-field>
<Text-field style="Text" layout="Normal">          Correcting an arc <Font italic="true">a</Font>=(<Font italic="true">u</Font>,<Font italic="true">v</Font>) means changing the value of <Font italic="true">y</Font>(<Font italic="true">v</Font>) to <Font italic="true">y</Font>(<Font italic="true">u</Font>) + <Font italic="true">w</Font> such that <Font italic="true">a</Font> becomes correct, and setting <Font italic="true">p</Font>(<Font italic="true">v</Font>) = <Font italic="true">u</Font> in the process;</Text-field>
<Text-field style="Text" layout="Normal"></Text-field>
<Text-field style="Text" layout="Normal">This work is part of a social service project consisting in the implementation of several graph theory algorithms with step-by-step execution, intended to be used as a teaching aid</Text-field>
<Text-field style="Text" layout="Normal">in graph theory related courses.</Text-field>
<Text-field style="Text" layout="Normal"></Text-field>
<Text-field style="Text" layout="Normal">The usage examples presented were randomly generated.</Text-field>
</Section>
<Section collapsed="false" MultipleChoiceAnswerIndex="-1" MultipleChoiceRandomizeChoices="false" TrueFalseAnswerIndex="-1" EssayAnswerRows="5" EssayAnswerColumns="60"><Title>
<Text-field style="Heading 1" layout="Heading 1">Module usage</Text-field></Title>
<Text-field superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]" alignment="left" firstindent="0" spacebelow="0" leftmargin="0" linespacing="0.0" initial="0" linebreak="space" rightmargin="0" bulletsuffix="" spaceabove="0" bullet="none" pagebreak-before="false"><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[0,0,0]" readonly="false" foreground="[0,0,0]">The </Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">DijkstraSP</Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[0,0,0]" readonly="false" foreground="[0,0,0]"> module contains only a single procedure definition for </Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">Dijkstra</Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[0,0,0]" readonly="false" foreground="[0,0,0]">(</Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="true" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[0,0,0]" readonly="false" foreground="[0,0,0]">G</Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[0,0,0]" readonly="false" foreground="[0,0,0]">, </Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="true" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[0,0,0]" readonly="false" foreground="[0,0,0]">initial</Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[0,0,0]" readonly="false" foreground="[0,0,0]">, </Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="true" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[0,0,0]" readonly="false" foreground="[0,0,0]">stepByStep</Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[0,0,0]" readonly="false" foreground="[0,0,0]">, </Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="true" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[0,0,0]" readonly="false" foreground="[0,0,0]">draw</Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[0,0,0]" readonly="false" foreground="[0,0,0]">), as follows:</Font></Text-field>
<Text-field superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]" alignment="left" firstindent="0" spacebelow="0" leftmargin="0" linespacing="0.0" initial="0" linebreak="space" rightmargin="0" bulletsuffix="" spaceabove="0" bullet="none" pagebreak-before="false"></Text-field>
<Text-field superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]" alignment="left" firstindent="0" spacebelow="0" leftmargin="0" linespacing="0.0" initial="0" linebreak="space" rightmargin="0" bulletsuffix="" spaceabove="0" bullet="none" pagebreak-before="false"><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">Calling Dijkstra(...) will attempt to calculate the shortest paths in graph </Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="true" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">G</Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]"> from </Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="true" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">initial</Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]"> to every other vertex using Dijkstra's Algorithm.</Font></Text-field>
<Text-field superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]" alignment="left" firstindent="0" spacebelow="0" leftmargin="0" linespacing="0.0" initial="0" linebreak="space" rightmargin="0" bulletsuffix="" spaceabove="0" bullet="none" pagebreak-before="false"></Text-field>
<Text-field superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]" alignment="left" firstindent="0" spacebelow="0" leftmargin="0" linespacing="0.0" initial="0" linebreak="space" rightmargin="0" bulletsuffix="" spaceabove="0" bullet="none" pagebreak-before="false"><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">The parameters taken by procedure Dijkstra(...) are explained below:</Font></Text-field>
<Text-field superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]" alignment="left" firstindent="0" spacebelow="0" leftmargin="0" linespacing="0.0" initial="0" linebreak="space" rightmargin="0" bulletsuffix="" spaceabove="0" bullet="none" pagebreak-before="false"></Text-field>
<Text-field superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]" alignment="left" firstindent="0" spacebelow="0" leftmargin="0" linespacing="0.0" initial="0" linebreak="space" rightmargin="0" bulletsuffix="" spaceabove="0" bullet="dot" pagebreak-before="false"><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">G is an object of type Graph from Maple's </Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="true" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">GraphTheory</Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]"> library, it is the graph for which the shortest paths will be computed. </Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="true" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">G</Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]"> must be defined as directed and have nonnegative arc weights, otherwise the procedure will terminate with an error.</Font></Text-field>
<Text-field superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]" alignment="left" firstindent="0" spacebelow="0" leftmargin="0" linespacing="0.0" initial="0" linebreak="space" rightmargin="0" bulletsuffix="" spaceabove="0" bullet="none" pagebreak-before="false"><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[0,0,0]" readonly="false" foreground="[0,0,0]">     </Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">This parameter is not optional</Font></Text-field>
<Text-field superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]" alignment="left" firstindent="0" spacebelow="0" leftmargin="0" linespacing="0.0" initial="0" linebreak="space" rightmargin="0" bulletsuffix="" spaceabove="0" bullet="none" pagebreak-before="false"></Text-field>
<Text-field superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]" alignment="left" firstindent="0" spacebelow="0" leftmargin="0" linespacing="0.0" initial="0" linebreak="space" rightmargin="0" bulletsuffix="" spaceabove="0" bullet="dot" pagebreak-before="false"><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="true" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">initial</Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]"> is a symbol representing the vertex of </Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="true" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">G</Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]"> from which the shortest paths will be calculated. If the given symbol is not in the vertex list of </Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="true" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">G</Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">, the procedure will terminate reporting an error, otherwise the vertex of </Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="true" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">G</Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]"> with a label matching the given symbol will be used as initial.</Font></Text-field>
<Text-field superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]" alignment="left" firstindent="0" spacebelow="0" leftmargin="0" linespacing="0.0" initial="0" linebreak="space" rightmargin="0" bulletsuffix="" spaceabove="0" bullet="none" pagebreak-before="false"><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">     This parameter is not optional.</Font></Text-field>
<Text-field superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]" alignment="left" firstindent="0" spacebelow="0" leftmargin="0" linespacing="0.0" initial="0" linebreak="space" rightmargin="0" bulletsuffix="" spaceabove="0" bullet="none" pagebreak-before="false"></Text-field>
<Text-field superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]" alignment="left" firstindent="0" spacebelow="0" leftmargin="0" linespacing="0.0" initial="0" linebreak="space" rightmargin="0" bulletsuffix="" spaceabove="0" bullet="dot" pagebreak-before="false"><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[0,0,0]" readonly="false" foreground="[0,0,0]"> </Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="true" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">stepByStep</Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]"> is a true/false value. When it is set to </Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="true" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">true</Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">, the procedure will print a message reporting whenever an arc is corrected or a vertex is scanned. When it is </Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="true" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">false</Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">, only the final result will be shown.</Font></Text-field>
<Text-field superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]" alignment="left" firstindent="0" spacebelow="0" leftmargin="0" linespacing="0.0" initial="0" linebreak="space" rightmargin="0" bulletsuffix="" spaceabove="0" bullet="none" pagebreak-before="false"><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">     This parameter is optional, and its default value is </Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="true" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">false.</Font></Text-field>
<Text-field superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]" alignment="left" firstindent="0" spacebelow="0" leftmargin="0" linespacing="0.0" initial="0" linebreak="space" rightmargin="0" bulletsuffix="" spaceabove="0" bullet="none" pagebreak-before="false"></Text-field>
<Text-field superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]" alignment="left" firstindent="0" spacebelow="0" leftmargin="0" linespacing="0.0" initial="0" linebreak="space" rightmargin="0" bulletsuffix="" spaceabove="0" bullet="dot" pagebreak-before="false"><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="true" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">draw</Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]"> is a true/false value. When it is set to </Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="true" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">true</Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">, the resulting shortest paths graph will be displayed after computation finishes; if both </Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="true" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">stepByStep </Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">and </Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="true" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">draw</Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]"> are </Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="true" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">true</Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]"> then the graph </Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="true" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">G</Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]"> will be drawn at every step, highlighting arcs currently in a shortest path in green, replaced arcs in red, and scanned vertices in cyan. When </Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="true" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">draw </Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">is set to </Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="true" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">false</Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">, the graphs will not be displayed, and the procedure will print a list containing the shortest paths to each vertex, in the format:</Font></Text-field>
<Text-field superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]" alignment="centred" firstindent="0" spacebelow="0" leftmargin="0" linespacing="0.0" initial="0" linebreak="space" rightmargin="0" bulletsuffix="" spaceabove="0" bullet="none" pagebreak-before="false"><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="true" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">[[v1,[route to v1],distance to v1],[v2,[route to v2],distance to v2],...,[vn,[route to vn],distance to vn]]</Font></Text-field>
<Text-field superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]" alignment="left" firstindent="0" spacebelow="0" leftmargin="0" linespacing="0.0" initial="0" linebreak="space" rightmargin="0" bulletsuffix="" spaceabove="0" bullet="none" pagebreak-before="false"><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">     This parameter is optional, and its default value is </Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="true" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">true</Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">.</Font></Text-field>
<Text-field superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]" alignment="left" firstindent="0" spacebelow="0" leftmargin="0" linespacing="0.0" initial="0" linebreak="space" rightmargin="0" bulletsuffix="" spaceabove="0" bullet="none" pagebreak-before="false"></Text-field>
<Text-field superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]" alignment="left" firstindent="0" spacebelow="0" leftmargin="0" linespacing="0.0" initial="0" linebreak="space" rightmargin="0" bulletsuffix="" spaceabove="0" bullet="none" pagebreak-before="false"><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[0,0,0]" readonly="false" foreground="[0,0,0]"> </Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">The return value can be one of three possibilities as follows:</Font></Text-field>
<Text-field superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]" alignment="left" firstindent="0" spacebelow="0" leftmargin="0" linespacing="0.0" initial="0" linebreak="space" rightmargin="0" bulletsuffix="" spaceabove="0" bullet="dot" pagebreak-before="false"><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">If </Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="true" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">draw</Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]"> is </Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="true" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">true</Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">, the procedure returns a subgraph </Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="true" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">H</Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]"> of </Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="true" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">G</Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]"> containing only the arcs of </Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="true" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">G </Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">which are used in a shortest path.</Font></Text-field>
<Text-field superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]" alignment="left" firstindent="0" spacebelow="0" leftmargin="0" linespacing="0.0" initial="0" linebreak="space" rightmargin="0" bulletsuffix="" spaceabove="0" bullet="dot" pagebreak-before="false"><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">If </Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="true" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">draw</Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]"> is </Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="true" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">false</Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">, the procedure will return a list containing the shortest paths to each vertex, this is so the value reported by Maple contains more useful information.</Font></Text-field>
<Text-field superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]" alignment="left" firstindent="0" spacebelow="0" leftmargin="0" linespacing="0.0" initial="0" linebreak="space" rightmargin="0" bulletsuffix="" spaceabove="0" bullet="dot" pagebreak-before="false"><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">If </Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="true" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">initial</Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]"> is a symbol not present in the vertex list of </Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="true" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">G</Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">, </Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="true" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">G</Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]"> is not a directed graph, </Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="true" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">G</Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]"> has negative weight arcs, or there are vertices unreachable from </Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="true" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">initial</Font><Font superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">, the procedure will return the string &quot;ERROR&quot;.</Font></Text-field>
</Section>
<Section collapsed="false" MultipleChoiceAnswerIndex="-1" MultipleChoiceRandomizeChoices="false" TrueFalseAnswerIndex="-1" EssayAnswerRows="5" EssayAnswerColumns="60"><Title>
<Text-field style="Heading 1" layout="Heading 1">Module definition and initialization</Text-field></Title>
<Text-field style="Text" layout="Normal"></Text-field>
<Group labelreference="L5">
<Input>
<Text-field prompt="&gt; " style="Maple Input" layout="Normal">restart:
with(GraphTheory):
DijkstraSP := module()
option package;
export Dijkstra;

Dijkstra := proc (G::Graph, initial, stepByStep::truefalse := false, draw::truefalse := true)
local H :: list, V :: list, S::set, E :: set, e :: list, g::Graph, finished::truefalse, replaced::set, usedArcs::Graph, initVert::set, minWeight::int, minIndex::int, head::int, tail::int, i::int, n::int, result::list, v:

#input check
if IsDirected(G)=false then
  printf(&quot;ERROR: input graph must be directed&quot;);
  return &quot;ERROR&quot;:   #undirected graph
end if:
#variable initialization
H:={}:   #List of edges of the graph representing the shortest paths
S:={op(Vertices(G))}:   #set of vertices to be scanned
E:={}:   #backup of G's arc list with weight information
for e in Edges(G,weights) do:
   if e[2]&lt;0 then
     printf(&quot;ERROR: input graph must have nonnegative arc weights&quot;);
     return &quot;ERROR&quot;:   #negative weight arc
   else
     E:=E union {e}:
   end if:
end do:   

if initial in S then   #initializes <Font italic="true">y</Font> and <Font italic="true">p</Font>
  n:=0:   #number of vertices in G
  V:=[]:   #contains the values of <Font italic="true">v</Font>, <Font italic="true">y</Font>(<Font italic="true">v</Font>) and index of <Font italic="true">p</Font>(<Font italic="true">v</Font>) for every <Font italic="true">v</Font>
  for v in S do:
    if v=initial then
      V:=[op(V), [v,-1,0]]:
    else
      V:=[op(V), [v,-1,infinity]]:
    end if:
    n:=n+1:
  end do:
else
  printf(&quot;ERROR: initial vertex not in graph&quot;);
  return &quot;ERROR&quot;:   #invalid initial vertex   
end if:

if draw then
  usedArcs:=Digraph(Vertices(G),{},'weighted'):   #arcs currently in a SP, used only when drawing the graph
  if stepByStep then
    <Font encoding="UTF-8">printf(&quot;key: yellow = unscanned vertices, cyan = scanned vertices, magenta = initial vertex, blue = original graph arcs,\134n\134tgreen = arcs in a SP, red = replaced arcs.\134n&quot;);</Font>
    replaced:={}:   #arcs previously in a SP replaced for shorter arcs, used only when drawing the graph 
  end if:
end if:

while S&lt;&gt;{} do:   #continue while <Font italic="true">S </Font>is not empty
 minWeight := infinity:
 for i from 1 to n do: #find v with y(v) minimum
   if V[i][1] in S and V[i][3]&lt;minWeight then
     minIndex:=i:
     minWeight:=V[i][3]:
   end if:
 end do:
 if minWeight = infinity then
   printf(&quot;ERROR: unreachable vertex&quot;);
   return &quot;ERROR&quot;:   #unreachable vertex
 else
   S:=S minus {V[minIndex][1]}:
   if stepByStep then
     <Font encoding="UTF-8">printf(&quot;scanning vertex %a:\134n&quot;,V[minIndex][1]);</Font>
   end if:
 end if:

 for e in E do:   #for each edge
  if e[1][1]=V[minIndex][1] then
    head:=-1:
    i:=1:
    while head=-1 do:   #find head of e (tail is v with y(v) minimum)
     if V[i][1]=e[1][2] then
      head:=i:
     end if:
     i:=i+1:
    end do:

   if V[head][3]=infinity or V[head][3]&gt;V[minIndex][3]+e[2] then   #if edge is incorrect, correct it
    if draw then
      if V[head][3]&lt;&gt;infinity then
        DeleteArc(usedArcs,[V[V[head][2]][1],V[head][1]]):
      end if:
      AddArc(usedArcs,e):
    end if:
    if stepByStep then
<Font encoding="UTF-8">      printf(&quot;corrected arc (%a,%a)\134n&quot;,e[1][1],e[1][2]);
</Font>      if draw then
       if V[head][3]&lt;&gt;infinity then
        replaced:=replaced union {[V[V[head][2]][1],V[head][1]]}:
        g:=Digraph(Vertices(G),replaced):
        HighlightSubgraph(G, g, red, yellow):
       end if:
       g:=Digraph(Vertices(G),Edges(usedArcs)):
       HighlightSubgraph(G, g, green, cyan):
       HighlightVertex(G,S,yellow):
       HighlightVertex(G,{initial},magenta):
       print(DrawGraph(G));
      end if:
    end if:
    V[head][3]:=V[minIndex][3]+e[2]:
    V[head][2]:=minIndex:
   end if:
  end if:
 end do:
end do:

if stepByStep then
<Font encoding="UTF-8">  printf(&quot;All vertices scanned, computation finished\134n&quot;):
</Font>end if:
if draw then   #if the option is set, draw the shortest path graph
<Font encoding="UTF-8">  printf(&quot;Obtained shortest paths graph:\134n&quot;):</Font>
  print(DrawGraph(usedArcs));
  return usedArcs:   #return the shortest path graph
else
  i:=0:
  result:=[ ]:
  for v in V do:   #for each vertex, rebuild the shortest path and store it
   if v[1]=initial then
    result:=[op(result),[initial,&quot;is the initial vertex&quot;, 0]]:
   else
    result:=[op(result),[v[1],[v[1]], v[3]]]:
    i:=v[2]:
    while i&lt;&gt;-1 do:
     result[nops(result)][2]:=[V[i][1],op(result[nops(result)][2])]:
     i:=V[i][2]:
    end do:
   end if:
  end do:
  if stepByStep then
<Font encoding="UTF-8">    printf(&quot;shortest paths found (format is [vertex, route, distance]):\134n%a\134n&quot;,result):
</Font>  end if:
  return result:   #return shortest path list
end if:

end proc:
end module:

with (DijkstraSP);</Text-field>
</Input>
</Group>
</Section>
<Section collapsed="false" MultipleChoiceAnswerIndex="-1" MultipleChoiceRandomizeChoices="false" TrueFalseAnswerIndex="-1" EssayAnswerRows="5" EssayAnswerColumns="60"><Title>
<Text-field style="Heading 1" layout="Heading 1">Usage examples</Text-field></Title>
<Group labelreference="L6">
<Input>
<Section collapsed="false" MultipleChoiceAnswerIndex="-1" MultipleChoiceRandomizeChoices="false" TrueFalseAnswerIndex="-1" EssayAnswerRows="5" EssayAnswerColumns="60"><Title>
<Text-field style="Heading 2" layout="Heading 2">Default Behavior: print resulting graph of shortest paths, without step-by-step reports.</Text-field></Title>
<Text-field prompt="&gt; " style="Maple Input" layout="Normal">vertices:=[&quot;a&quot;,&quot;b&quot;,&quot;c&quot;,&quot;d&quot;]:
arcs:={[[&quot;a&quot;, &quot;b&quot;], 1],[[&quot;a&quot;, &quot;c&quot;], 4],[[&quot;c&quot;, &quot;b&quot;], 2],[[&quot;b&quot;, &quot;d&quot;], 5],[[&quot;c&quot;, &quot;d&quot;], 9]}:
g := Digraph(vertices,arcs):
Dijkstra(g,&quot;a&quot;);</Text-field>
</Section>
</Input>
</Group>
<Section collapsed="false" MultipleChoiceAnswerIndex="-1" MultipleChoiceRandomizeChoices="false" TrueFalseAnswerIndex="-1" EssayAnswerRows="5" EssayAnswerColumns="60"><Title>
<Text-field style="Heading 2" layout="Heading 2">Shows step-by-step reports, but doesn't print the graph</Text-field></Title>
<Group labelreference="L8">
<Input>
<Text-field prompt="&gt; " style="Maple Input" layout="Normal">vertices:=[1,2,3,4,5,6]:
arcs:={[[1,2],6],[[1,3],2],[[4,1],5],[[2,3],6],[[2,4],4],[[2,5],5],[[3,4],6],[[3,5],3],[[6,4],2],[[4,5],6],[[5,6],2], [[6,1],1]}:
g := Digraph(vertices,arcs):
Dijkstra(g,6,true,false):</Text-field>
</Input>
</Group>
</Section>
<Section collapsed="false" MultipleChoiceAnswerIndex="-1" MultipleChoiceRandomizeChoices="false" TrueFalseAnswerIndex="-1" EssayAnswerRows="5" EssayAnswerColumns="60"><Title>
<Text-field style="Heading 2" layout="Heading 2">Shows step-by-step process with graphs for each step</Text-field></Title>
<Group labelreference="L25" drawlabel="true">
<Input>
<Text-field prompt="&gt; " style="Maple Input" layout="Normal">vertices:=[&quot;a&quot;,&quot;b&quot;,&quot;c&quot;,&quot;d&quot;,&quot;e&quot;]:
arcs:={[[&quot;a&quot;,&quot;b&quot;],3],[[&quot;a&quot;,&quot;c&quot;],2],[[&quot;d&quot;,&quot;a&quot;],2],[[&quot;b&quot;,&quot;c&quot;],8],[[&quot;b&quot;,&quot;d&quot;],2],[[&quot;b&quot;,&quot;e&quot;],4],[[&quot;e&quot;,&quot;c&quot;],4],[[&quot;d&quot;,&quot;e&quot;],1]}:
g := Digraph(vertices,arcs):
Dijkstra(g,&quot;b&quot;,true);</Text-field>
</Input>
</Group>
</Section>
</Section>
<Section collapsed="false" MultipleChoiceAnswerIndex="-1" MultipleChoiceRandomizeChoices="false" TrueFalseAnswerIndex="-1" EssayAnswerRows="5" EssayAnswerColumns="60"><Title>
<Text-field style="Heading 1" layout="Heading 1">References</Text-field></Title>
<Group labelreference="L27">
<Input>
<Text-field style="Text" layout="Normal">Cook, William J. et. al. <Font italic="true">Combinatorial Optimization</Font>. Wiley-Interscience, 1998. ISBN 0-471-55894-X</Text-field>
</Input>
</Group>
</Section>
<Group labelreference="L38">
<Input>
<Text-field style="Text" layout="Normal"></Text-field>
<Text-field style="Text" layout="Normal"><Font encoding="UTF-8" italic="true">Legal Notice: \302\251 2</Font><Font italic="true">016. Maplesoft and Maple are trademarks of Waterloo Maple Inc. Neither Maplesoft nor the authors are responsible for any errors contained within and are not liable for any damages resulting from the use of this material.  This application is intended for non-commercial, non-profit use only. Contact the authors for permission if you wish to use this application in for-profit activities. </Font></Text-field>
</Input>
</Group>
<Text-field superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]" alignment="left" firstindent="0" spacebelow="0" leftmargin="0" linespacing="0.0" initial="0" linebreak="space" rightmargin="0" bulletsuffix="" spaceabove="0" bullet="none" pagebreak-before="false"></Text-field>
</Worksheet>