On Erd˝os-Gallai and Havel-Hakimi algorithms
On Erd˝os-Gallai and Havel-Hakimi algorithms
On Erd˝os-Gallai and Havel-Hakimi algorithms
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
<strong>On</strong> Erdős-<strong>Gallai</strong> <strong>and</strong> <strong>Havel</strong>-<strong>Hakimi</strong> <strong>algorithms</strong> 9<br />
elements of the pairs formed from the tail <strong>and</strong> from the beginning of the head,<br />
that is<br />
Xi,1 ≤ min(Hhi , Tn − Ti, hi(n − i)). (6)<br />
A similar train of thought results<br />
Xi,2 ≤ min(Hi − Hhi , Tn − Ti, (i − hi)(n − i)). (7)<br />
Xi,3 is at most hi(i − hi) <strong>and</strong> at most Hi, implying<br />
Xi,3 ≤ min(hi(i − hi), Hi). (8)<br />
Xi,4 is at most hi<br />
2 <strong>and</strong> at most Hhi , implying<br />
<br />
hi<br />
Xi,4 ≤ min( , Hhi ), (9)<br />
2<br />
while Xi,5 is at most i−hi<br />
2 <strong>and</strong> at most Hi − Hhi , implying<br />
<br />
i − hi<br />
Xi,5 ≤ . (10)<br />
2<br />
A requirement is also, that the tail can overrun its capacity, that is<br />
Summing of (6), (7), (8), (9), <strong>and</strong> (10) results<br />
Xi,1 + Xi,2 ≤ Ti. (11)<br />
Hi ≤ Xi,1 + Xi,2 + Xi,3 + 2Xi,4 + 2Xi,5. (12)<br />
Substituting of (6), (7), (8), (9), <strong>and</strong> (10) into (12) results (4), while (11) is<br />
equivalent with (5). <br />
The following algorithm executes the test based on Lemma 4.<br />
Input. n: the number of vertices (n ≥ 1);<br />
b = (b1, . . . , bn): an n-even sequence, accepted by Binomial-Test;<br />
H = (H1, . . . , Hn): Hi the sum of the first i elements of b;<br />
T = (T1, . . . , Tn): Ti the sum of the last n − i elements of b.<br />
Output. L: logical variable (L = False signals,that b is not graphical, while<br />
L = True shows, that the test could nor decide, whether b is graphical).<br />
Working variables. i: cycle variable;<br />
h: the actual value of hi X = (X1, X2, X3, X4, X5): Xj is the value of the actual<br />
Xi,j of the end of the head.