23.06.2013 Aufrufe

aktuelle Version des Vorlesungsskripts - ZIB

aktuelle Version des Vorlesungsskripts - ZIB

aktuelle Version des Vorlesungsskripts - ZIB

MEHR ANZEIGEN
WENIGER ANZEIGEN

Sie wollen auch ein ePaper? Erhöhen Sie die Reichweite Ihrer Titel.

YUMPU macht aus Druck-PDFs automatisch weboptimierte ePaper, die Google liebt.

inp, { input file }<br />

outp : text; { output file }<br />

BEGIN {MAIN PROGRAM}<br />

{====== Input of complete graph =====}<br />

reset(inp);<br />

rewrite(outp);<br />

{- number of no<strong>des</strong> -}<br />

writeln(outp,’Enter number of no<strong>des</strong>:’);<br />

read(inp,n);<br />

IF (nmax_n) THEN<br />

BEGIN<br />

writeln(outp,’Number of no<strong>des</strong> too large or not positive!’);<br />

HALT;<br />

END;<br />

{- initialize dope vector -}<br />

nchoose2 := (n * (n-1)) DIV 2;<br />

FOR i:=1 TO nchoose2 DO<br />

w[i] := inf;<br />

dope[1] := -1;<br />

FOR i:=2 TO n DO<br />

dope[i] := dope[i-1] + n - i;<br />

{- input mode -}<br />

writeln(outp,’Enter input mode:’);<br />

read(inp,mode);<br />

{- edge weights -}<br />

CASE mode OF<br />

0 : {* full matrix *}<br />

BEGIN<br />

FOR i:=1 TO n DO<br />

FOR j:=1 TO n DO<br />

BEGIN<br />

read(inp, c);<br />

IF i0) DO<br />

BEGIN<br />

IF (in) OR<br />

(jn)<br />

THEN BEGIN<br />

writeln(outp,’Input error, node out of range!’);<br />

HALT;<br />

END;<br />

IF i

Hurra! Ihre Datei wurde hochgeladen und ist bereit für die Veröffentlichung.

Erfolgreich gespeichert!

Leider ist etwas schief gelaufen!