Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
foreach v
{\displaystyle \in }
\in V(G) do d(v) =
{\displaystyle \infty }
\infty ;
A :=
{\displaystyle g_{b}}
{\displaystyle g_{b}}
d(a) := 0
X :=
{\displaystyle \emptyset }
\emptyset
foreach z : z
{\displaystyle \in }
\in
{\displaystyle M_{(g_{b})}}
{\displaystyle M_{(g_{b})}} do
X := X
{\displaystyle \cup }
\cup {z}
d(z) := gew(
{\displaystyle g_{b}}
{\displaystyle g_{b}},z);
/* X en d zijn nu geïnitialiseerd */
while not(X =
{\displaystyle \emptyset }
\emptyset) do
/* X is nog niet leeg */
y : (y
{\displaystyle \in }
\in X)
{\displaystyle \land }
{\displaystyle \land } (d(y) = MIN {d(y')|y'
{\displaystyle \in }
\in X}
/* y is dus het element van X met de laagste waarde van d(v) -- dit is de definitieve waarde van d(y) */
A := A
{\displaystyle \cup }
\cup {y}
X := X
{\displaystyle \setminus }
\setminus{y}
/* y is nu verplaatst van X naar A */
foreach z: z
{\displaystyle \in }
\in M_(y)
{\displaystyle \land }
{\displaystyle \land } not (z
{\displaystyle \in }
\in A) do
if not (z
{\displaystyle \in }
\in X) then
X := X
{\displaystyle \cup }
\cup {z}
d(z) := d(y) + gew(y,z)
else
/* dus z
{\displaystyle \in }
\in X */
d(z) := MIN{d(z), d(y) + gew(y,z)}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.