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.
04 if Hn odd<br />
05 L = False<br />
06 return L<br />
07 L = True<br />
08 return L<br />
<strong>On</strong> Erdős-<strong>Gallai</strong> <strong>and</strong> <strong>Havel</strong>-<strong>Hakimi</strong> <strong>algorithms</strong> 7<br />
The running time of this algorithm is Θ(n) in all cases. Figure 1 characterizes<br />
the efficiency of Parity-test.<br />
(1) is only a necessary condition, therefore Parity-Test is only an approximate<br />
(filtering) algorithm.<br />
3.2 Binomial test<br />
Our second test is based on the second necessary condition of Erdős-<strong>Gallai</strong><br />
theorem. It received the given name since we estimate the number of the inner<br />
edges of the head of b using a binomial coefficient. Let Ti = bi+1 +· · ·+bn (i =<br />
1, . . . , n).<br />
Lemma 3 If n ≥ 1 <strong>and</strong> b is an n-graphical sequence, then<br />
Hi ≤ i(i − 1) + Ti (i = 1, . . . , n − 1). (3)<br />
Proof. The left side of (3) represents the degree requirement of the head of b.<br />
<strong>On</strong> the right side of (3) i(i − 1) is an upper bound of the inner degree capacity<br />
of the head, while Ti is an upper bound of the degree capacity of the tail,<br />
belonging to the index i. <br />
The following program is based on Lemma 3.<br />
Input. n: number of the vertices (n ≥ 1);<br />
b = (b1, . . . , bn): an n-regular even sequence;<br />
H = (H1, . . . , Hn): Hi the sum of the first i elements of b;<br />
H0: auxiliary variable, helping to compute the elements of H.<br />
Output. L: logical variable (L = False signals, that b is surely not graphical,<br />
while L = True shows, that the test could not decide, whether b is graphical).<br />
Working variables. i: cycle variable;<br />
T = (T1, . . . , Tn): Ti the sum of the last n − i elements of b;<br />
T0: auxiliary variable, helping to compute the elements of T.<br />
Binomial-Test(n, b, H, L)<br />
01 T0 = 0<br />
02 for i = 1 to n − 1