fbpx
Wikipedia

Havel–Hakimi algorithm

The Havel–Hakimi algorithm is an algorithm in graph theory solving the graph realization problem. That is, it answers the following question: Given a finite list of nonnegative integers in non-increasing order, is there a simple graph such that its degree sequence is exactly this list? A simple graph contains no double edges or loops.[1] The degree sequence is a list of numbers in nonincreasing order indicating the number of edges incident to each vertex in the graph.[2] If a simple graph exists for exactly the given degree sequence, the list of integers is called graphic. The Havel-Hakimi algorithm constructs a special solution if a simple graph for the given degree sequence exists, or proves that one cannot find a positive answer. This construction is based on a recursive algorithm. The algorithm was published by Havel (1955), and later by Hakimi (1962).

The algorithm

The Havel-Hakimi algorithm is based on the following theorem.

Let   be a finite list of nonnegative integers that is nonincreasing. Let   be a second finite list of nonnegative integers that is rearranged to be nonincreasing. List   is graphic if and only if list   is graphic.

If the given list   is graphic, then the theorem will be applied at most   times setting in each further step  . Note that it can be necessary to sort this list again. This process ends when the whole list   consists of zeros. Let   be a simple graph with the degree sequence  : Let the vertex   have degree  ; let the vertices   have respective degrees  ; let the vertices   have respective degrees  . In each step of the algorithm, one constructs the edges of a graph with vertices  —i.e., if it is possible to reduce the list   to  , then we add edges  . When the list   cannot be reduced to a list   of nonnegative integers in any step of this approach, the theorem proves that the list   from the beginning is not graphic.

Proof

The following is a summary based on the proof of the Havel-Hakimi algorithm in Invitation to Combinatorics (Shahriari 2022).

To prove the Havel-Hakimi algorithm always works, assume that   is graphic, and there exists a simple graph   with the degree sequence  . Then we add a new vertex   adjacent to the   vertices with degrees   to obtain the degree sequence  .

To prove the other direction, assume that   is graphic, and there exists a simple graph   with the degree sequence   and vertices  . We do not know which   vertices are adjacent to  , so we have two possible cases.

In the first case,   is adjacent to the vertices   in  . In this case, we remove   with all its incident edges to obtain the degree sequence  .

In the second case,   is not adjacent to some vertex   for some   in  . Then we can change the graph   so that   is adjacent to   while maintaining the same degree sequence  . Since   has degree  , the vertex   must be adjacent to some vertex   in   for  : Let the degree of   be  . We know  , as the degree sequence   is in non-increasing order.

Since  , we have two possibilities: Either  , or  . If  , then by switching the places of the vertices   and  , we can adjust   so that   is adjacent to   instead of   If  , then since   is adjacent to more vertices than  , let another vertex   be adjacent to   and not  . Then we can adjust   by removing the edges   and  , and adding the edges   and  . This modification preserves the degree sequence of  , but the vertex   is now adjacent to   instead of  . In this way, any vertex not connected to   can be adjusted accordingly so that   is adjacent to   while maintaining the original degree sequence   of  . Thus any vertex not connected to   can be connected to   using the above method, and then we have the first case once more, through which we can obtain the degree sequence  . Hence,   is graphic if and only if   is also graphic.

The time complexity of the algorithm is  .

Examples

Let   be a nonincreasing, finite degree sequence of nonnegative integers. To test whether this degree sequence is graphic, we apply the Havel-Hakimi algorithm:

First, we remove the vertex with the highest degree — in this case,   —  and all its incident edges to get   (assuming the vertex with highest degree is adjacent to the   vertices with next highest degree). We rearrange this sequence in nonincreasing order to get  . We repeat the process, removing the vertex with the next highest degree to get   and rearranging to get  . We continue this removal to get  , and then  . This sequence is clearly graphic, as it is the simple graph of   isolated vertices.

To show an example of a non-graphic sequence, let   be a nonincreasing, finite degree sequence of nonnegative integers. Applying the algorithm, we first remove the degree   vertex and all its incident edges to get  . Already, we know this degree sequence is not graphic, since it claims to have   vertices with one vertex not adjacent to any of the other vertices; thus, the maximum degree of the other vertices is  . This means that two of the vertices are connected to all the other vertices with the exception of the isolated one, so the minimum degree of each vertex should be  ; however, the sequence claims to have a vertex with degree  . Thus, the sequence is not graphic.

For the sake of the algorithm, if we were to reiterate the process, we would get   which is yet more clearly not graphic. One vertex claims to have a degree of  , and yet only two other vertices have neighbors. Thus the sequence cannot be graphic.

See also

Notes

  1. ^ From Shahriari (2022, p. 48): "Definition 2.17 (Graphs & Subgraphs). A simple graph (or just a graph) G is a pair of sets (V, E) where V is a nonempty set called the set of vertices of G, and E is a (possibly empty) set of unordered pairs of distinct elements of V. The set E is called the set of edges of G. If the number of vertices of G is finite, then G is a finite graph (or a finite simple graph)."
  2. ^ From Shahriari (2022, p. 355): "Definition 10.6 (The degree sequence of a graph; Graphic sequences). The degree sequence of a graph is the list of the degrees of its vertices in non-increasing order. A non-increasing sequence of non-negative integers is called graphic, if there exists a simple graph whose degree sequence is precisely that sequence.”

References

  • Havel, Václav (1955), "A remark on the existence of finite graphs", Časopis pro pěstování matematiky (in Czech), 80: 477–480
  • Hakimi, S. L. (1962), "On realizability of a set of integers as degrees of the vertices of a linear graph. I", Journal of the Society for Industrial and Applied Mathematics, 10: 496–506, MR 0148049.
  • Shahriari, Shahriar (2022), Invitation to Combinatorics, Cambridge U. Press.
  • West, Douglas B. (2001). Introduction to graph theory. Second Edition. Prentice Hall, 2001. 45-46.

havel, hakimi, algorithm, this, article, includes, list, references, related, reading, external, links, sources, remain, unclear, because, lacks, inline, citations, please, help, improve, this, article, introducing, more, precise, citations, june, 2020, learn,. This article includes a list of references related reading or external links but its sources remain unclear because it lacks inline citations Please help to improve this article by introducing more precise citations June 2020 Learn how and when to remove this template message The Havel Hakimi algorithm is an algorithm in graph theory solving the graph realization problem That is it answers the following question Given a finite list of nonnegative integers in non increasing order is there a simple graph such that its degree sequence is exactly this list A simple graph contains no double edges or loops 1 The degree sequence is a list of numbers in nonincreasing order indicating the number of edges incident to each vertex in the graph 2 If a simple graph exists for exactly the given degree sequence the list of integers is called graphic The Havel Hakimi algorithm constructs a special solution if a simple graph for the given degree sequence exists or proves that one cannot find a positive answer This construction is based on a recursive algorithm The algorithm was published by Havel 1955 and later by Hakimi 1962 Contents 1 The algorithm 1 1 Proof 2 Examples 3 See also 4 Notes 5 ReferencesThe algorithm EditThe Havel Hakimi algorithm is based on the following theorem Let A s t 1 t s d 1 d n displaystyle A s t 1 t s d 1 d n be a finite list of nonnegative integers that is nonincreasing Let A t 1 1 t s 1 d 1 d n displaystyle A t 1 1 t s 1 d 1 d n be a second finite list of nonnegative integers that is rearranged to be nonincreasing List A displaystyle A is graphic if and only if list A displaystyle A is graphic If the given list A displaystyle A is graphic then the theorem will be applied at most n 1 displaystyle n 1 times setting in each further step A A displaystyle A A Note that it can be necessary to sort this list again This process ends when the whole list A displaystyle A consists of zeros Let G displaystyle G be a simple graph with the degree sequence A displaystyle A Let the vertex S displaystyle S have degree s displaystyle s let the vertices T 1 T s displaystyle T 1 T s have respective degrees t 1 t s displaystyle t 1 t s let the vertices D 1 D n displaystyle D 1 D n have respective degrees d 1 d n displaystyle d 1 d n In each step of the algorithm one constructs the edges of a graph with vertices T 1 T s displaystyle T 1 T s i e if it is possible to reduce the list A displaystyle A to A displaystyle A then we add edges S T 1 S T 2 S T s displaystyle S T 1 S T 2 cdots S T s When the list A displaystyle A cannot be reduced to a list A displaystyle A of nonnegative integers in any step of this approach the theorem proves that the list A displaystyle A from the beginning is not graphic Proof Edit The following is a summary based on the proof of the Havel Hakimi algorithm in Invitation to Combinatorics Shahriari 2022 To prove the Havel Hakimi algorithm always works assume that A displaystyle A is graphic and there exists a simple graph G displaystyle G with the degree sequence A t 1 1 t s 1 d 1 d n displaystyle A t 1 1 t s 1 d 1 d n Then we add a new vertex v displaystyle v adjacent to the s displaystyle s vertices with degrees t 1 1 t s 1 displaystyle t 1 1 t s 1 to obtain the degree sequence A displaystyle A To prove the other direction assume that A displaystyle A is graphic and there exists a simple graph G displaystyle G with the degree sequence A s t 1 t s d 1 d n displaystyle A s t 1 t s d 1 d n and vertices S T 1 T s D 1 D n displaystyle S T 1 T s D 1 D n We do not know which s displaystyle s vertices are adjacent to S displaystyle S so we have two possible cases In the first case S displaystyle S is adjacent to the vertices T 1 T s displaystyle T 1 T s in G displaystyle G In this case we remove S displaystyle S with all its incident edges to obtain the degree sequence A displaystyle A In the second case S displaystyle S is not adjacent to some vertex T i displaystyle T i for some 1 i s displaystyle 1 leq i leq s in G displaystyle G Then we can change the graph G displaystyle G so that S displaystyle S is adjacent to T i displaystyle T i while maintaining the same degree sequence A displaystyle A Since S displaystyle S has degree s displaystyle s the vertex S displaystyle S must be adjacent to some vertex D j displaystyle D j in G displaystyle G for 1 j n displaystyle 1 leq j leq n Let the degree of D j displaystyle D j be d j displaystyle d j We know t i d j displaystyle t i geq d j as the degree sequence A displaystyle A is in non increasing order Since t i d j displaystyle t i geq d j we have two possibilities Either t i d j displaystyle t i d j or t i gt d j displaystyle t i gt d j If t i d j displaystyle t i d j then by switching the places of the vertices T i displaystyle T i and D j displaystyle D j we can adjust G displaystyle G so that S displaystyle S is adjacent to T i displaystyle T i instead of D j displaystyle D j If t i gt d j displaystyle t i gt d j then since T i displaystyle T i is adjacent to more vertices than D j displaystyle D j let another vertex W displaystyle W be adjacent to T i displaystyle T i and not D j displaystyle D j Then we can adjust G displaystyle G by removing the edges S D j displaystyle left S D j right and T i W displaystyle left T i W right and adding the edges S T i displaystyle left S T i right and W D j displaystyle left W D j right This modification preserves the degree sequence of G displaystyle G but the vertex S displaystyle S is now adjacent to T i displaystyle T i instead of D j displaystyle D j In this way any vertex not connected to S displaystyle S can be adjusted accordingly so that S displaystyle S is adjacent to T i displaystyle T i while maintaining the original degree sequence A displaystyle A of G displaystyle G Thus any vertex not connected to S displaystyle S can be connected to S displaystyle S using the above method and then we have the first case once more through which we can obtain the degree sequence A displaystyle A Hence A displaystyle A is graphic if and only if A displaystyle A is also graphic The time complexity of the algorithm is O n 2 displaystyle O n 2 Examples EditLet 6 3 3 3 3 2 2 2 2 1 1 displaystyle 6 3 3 3 3 2 2 2 2 1 1 be a nonincreasing finite degree sequence of nonnegative integers To test whether this degree sequence is graphic we apply the Havel Hakimi algorithm First we remove the vertex with the highest degree in this case 6 displaystyle 6 and all its incident edges to get 2 2 2 2 1 1 2 2 1 1 displaystyle 2 2 2 2 1 1 2 2 1 1 assuming the vertex with highest degree is adjacent to the 6 displaystyle 6 vertices with next highest degree We rearrange this sequence in nonincreasing order to get 2 2 2 2 2 2 1 1 1 1 displaystyle 2 2 2 2 2 2 1 1 1 1 We repeat the process removing the vertex with the next highest degree to get 1 1 2 2 2 1 1 1 1 displaystyle 1 1 2 2 2 1 1 1 1 and rearranging to get 2 2 2 1 1 1 1 1 1 displaystyle 2 2 2 1 1 1 1 1 1 We continue this removal to get 1 1 1 1 1 1 1 1 displaystyle 1 1 1 1 1 1 1 1 and then 0 0 0 0 0 0 0 0 displaystyle 0 0 0 0 0 0 0 0 This sequence is clearly graphic as it is the simple graph of 8 displaystyle 8 isolated vertices To show an example of a non graphic sequence let 6 5 5 4 3 2 1 displaystyle 6 5 5 4 3 2 1 be a nonincreasing finite degree sequence of nonnegative integers Applying the algorithm we first remove the degree 6 displaystyle 6 vertex and all its incident edges to get 4 4 3 2 1 0 displaystyle 4 4 3 2 1 0 Already we know this degree sequence is not graphic since it claims to have 6 displaystyle 6 vertices with one vertex not adjacent to any of the other vertices thus the maximum degree of the other vertices is 4 displaystyle 4 This means that two of the vertices are connected to all the other vertices with the exception of the isolated one so the minimum degree of each vertex should be 2 displaystyle 2 however the sequence claims to have a vertex with degree 1 displaystyle 1 Thus the sequence is not graphic For the sake of the algorithm if we were to reiterate the process we would get 3 2 1 0 0 displaystyle 3 2 1 0 0 which is yet more clearly not graphic One vertex claims to have a degree of 3 displaystyle 3 and yet only two other vertices have neighbors Thus the sequence cannot be graphic See also EditErdos Gallai theoremNotes Edit From Shahriari 2022 p 48 Definition 2 17 Graphs amp Subgraphs A simple graph or just a graph G is a pair of sets V E where V is a nonempty set called the set of vertices of G and E is a possibly empty set of unordered pairs of distinct elements of V The set E is called the set of edges of G If the number of vertices of G is finite then G is a finite graph or a finite simple graph From Shahriari 2022 p 355 Definition 10 6 The degree sequence of a graph Graphic sequences The degree sequence of a graph is the list of the degrees of its vertices in non increasing order A non increasing sequence of non negative integers is called graphic if there exists a simple graph whose degree sequence is precisely that sequence References EditHavel Vaclav 1955 A remark on the existence of finite graphs Casopis pro pestovani matematiky in Czech 80 477 480 Hakimi S L 1962 On realizability of a set of integers as degrees of the vertices of a linear graph I Journal of the Society for Industrial and Applied Mathematics 10 496 506 MR 0148049 Shahriari Shahriar 2022 Invitation to Combinatorics Cambridge U Press West Douglas B 2001 Introduction to graph theory Second Edition Prentice Hall 2001 45 46 Retrieved from https en wikipedia org w index php title Havel Hakimi algorithm amp oldid 1126594764, wikipedia, wiki, book, books, library,

article

, read, download, free, free download, mp3, video, mp4, 3gp, jpg, jpeg, gif, png, picture, music, song, movie, book, game, games.