propagation anisotropies parametrized dimensional
Phase Transitions in Combinatorial Optimization Problems
Chapter 0 Introduction to graphs
The next three sections give a short introduction to graph theory and graph algorithms. The first one deals with the basic definitions and concepts, and introduces some graph problems. The second one is dedicated to some fundamental graph algorithms. In the third one, we will discuss random graphs, which will be of fundamental importance throughout this course.
Let us begin by mentioning some books related to graph theory. All of them go well beyond everything we will need concerning graphs:
-
•
Gary Chartrand, Introductory graph theory, Dover Publ. Inc., New York, 1985.
This little paperback contains a nice, easy-to-read introduction to graph theory. Every chapter is based on “real-world” examples, which are mapped to graph problems. It is a good book for everyone who wishes to know more about graphs without working through a difficult mathematical book. -
•
Béla Bollobás, Modern Graph Theory, Springer, New York 1998.
Written by one of the leading graph theorists, this book covers the first and third section (and much more). It is very good and complete, but mathematically quite difficult. -
•
Robert Sedgewick, Algorithms in C: Graph Algorithms, Addison Wesley, Boston 2002.
This book collects many graph algorithms, including extensive descriptions and proofs of their correctness.
1 Basic concepts and graph problems
1 The bridges of Königsberg and Eulerian graphs
The earliest use of graph theoretical methods probably goes back to the 18th century. At this time, there were seven bridges crossing the river Pregel in the town of Königsberg. The folks had long amused themselves with the following problem: Is it possible to walk through the town using every bridge just once, and returning home at the end? The problem was solved by Leonhardt Euler (1707–1783) in 1736 by mapping it to a graph problem and solving it for arbitrary graphs [2], i. e., for arbitrary towns, city maps, etc. In the case of Königsberg, he had to draw the slightly disappointing consequence that no such round-walk existed.
Figure 1 shows the river Pregel, Königsberg was situated on both sides and both islands. The seven bridges are also shown. The mapping to a graph is given below. Every river side, island and bridge is assigned a vertex, drawn as a circle, two vertices are connected by an edge, drawn as a line, if they are also physically connected. To give a more precise description, we have to introduce the basic graph-theoretical terminology which is summarized in the definitions below.
[htb]
The bridges of Königsberg and its graph representation. Vertices are denoted by circles, edges by lines.
Basic definitions:
-
•
An (undirected) graph is given by its vertices and its undirected edges . Note that both and denote the same edge.
-
•
The order counts the number of vertices.
-
•
The size counts the number of edges.
-
•
Two vertices are adjacent / neighboring if .
-
•
The edge is incident to its end vertices and .
-
•
The degree of vertex equals the number of adjacent vertices. Vertices of zero degree are called isolated.
-
•
A graph is a subgraph of if .
-
•
A graph is an induced subgraph of if and , i. e., contains all edges from connecting two vertices in .
-
•
A subgraph is a path of if it has the form , . The length of the path is . and are called end points. The path goes from to and vice versa. One says and are connected by the path. Note that, within a path, each vertex (possibly except for the end points) is “visited” only once.
-
•
A path with , i. e., a closed path, is called a cycle.
-
•
A sequence of edges , is called a walk. Within a walk some vertices or edges may occur several times.
-
•
A walk with pairwise distinct edges is called a trail. Hence a trail is also a subgraph of .
-
•
A circuit is trail with coinciding end points, i. e., a closed trail. (NB: cycles are circuits, but not vice versa, because a circuit may pass through several times through the same vertex).
-
•
The graph is connected if all pairs of vertices are connected by paths.
-
•
The graph is a connected component of if it is a connected, induced subgraph of , and there are no edges in connecting vertices of with those in .
-
•
The complement graph has edge set . It is thus obtained from by connecting all vertex pairs by an edge, which are not adjacent in and disconnecting all vertex pairs, which are adjacent in .
-
•
A weighted graph is a graph with edge weights .
Example 1.1.
Graphs We consider the graph shown in Fig. 1. It can be written as with
Hence, the graphs has vertices and edges. Since , the vertices and are adjacent. Vertex has degree deg, while vertex has degree 5.
For example, with and , , , is a path from to . is connected, because all vertices are connected by paths to all other vertices. The sequence of edges is a walk, but it does not correspond to a path, because some vertices are visited twice. The sequence of edges , , , , , , , is a trail, in particular it is a circuit.
Going back to the problem of the people from Königsberg, formulated in graph-theoretical language, they were confronted with the following question:
EULERIAN CIRCUIT: Given a graph, is there a circuit using every edge exactly once?
The amazing point about Euler’s proof is the following: The existence of a Eulerian circuit – which obviously is a global object – can be decided looking to purely local properties, in this case to the vertex degrees.
Theorem: A connected graph is Eulerian (has an Eulerian cycle) iff all vertex degrees are even.
Proof 1.2.
This direction is trivial. Following the Eulerian circuit, every vertex which is entered is also left, every time using previously unvisited edges. All degrees are consequently even.
The other direction is a bit harder. We will proof it by induction on the graph size , for arbitrary graphs having only even vertex degrees.
The theorem is obviously true for (one isolated vertex) and (triangle) which are the simplest graphs with even degrees.
Now we take any , and we assume the theorem to be true for all graphs of size smaller than . We will show that the theorem is also true for a connected graph of size having only even degrees.
Because of , the graph is non-trivial, because of the even degrees it contains vertices of degree at least 2. Then contains a cycle, which can be seen in the following way: Start in any vertex and walk along edges. Whenever you enter a new vertex, there is at least one unused edge which you can use to exit the vertex again. At a certain moment you enter a vertex already seen (at most after steps), the part of the walk starting there is a cycle.
Every cycle is also a circuit. Consider now a circuit of maximal size . If is a Eulerian circuit in , everything is OK. If not, we have , and the subgraph has at least one non-trivial connected component . A circuit has even degrees, thus and all its connected components have even degrees. Since has size , it has an Eulerian circuit which can be added to , violating the maximality of . Thus, has to be an Eulerian circuit, and the proof is complete.
Going back to Königsberg, we see that there are vertices of odd degrees. No Eulerian circuit can exist, and the inhabitants have either to skip bridges or to cross some twice if they walk through their town.
In the above definitions for undirected graphs, edges have no orientation. This is different for directed graphs (also called digraphs). Most definitions for directed graphs are the same as for undirected graphs. Here we list some differences and additional definitions.
-
•
A directed graph is similar to an undirected graph, except that the edges (also called arcs in this case) are ordered pairs of vertices.
-
•
The outdegree is the number of outgoing edges .
-
•
The indegree is the number of incoming edges .
-
•
A directed path is defined similarly to a path for undirected graphs, except that all edges must have the same “forward” orientation along the path. Formally, a path form to is a subgraph with ,, ,, …,.
-
•
A directed graph is called strongly connected if for all pairs of vertices , there exists a directed path in from to and a path from to . A strongly connected component (SCC) of a directed graph is a strongly connected subgraph of maximal size, i. e., it cannot be extended by adding vertices/edges while still being strongly connected.
2 Hamiltonian graphs
Imagine you have to organize a diplomatic dinner. The main problem is placing the ambassadors around a round table: There are some countries which are strong enemies, and during the dinner there is a risk that the diplomats will not behave very diplomatically. You therefore prefer to place only those ambassadors in neighboring seats who belong to countries which have peaceful relations.
[htb]
Left: The round table where the diplomats have to be placed. Right: Graph of relations, only ambassadors with positive relations are connected and can be neighbors at the table.
Again, this problem can be mapped to a graph-theoretical question. The corresponding graph is the “graph of good relations”. The vertices are identified with the ambassadors, and any two having good relations, i. e., potential neighbors, are connected by an edge, see Fig. 2. The problem now reduces to finding a cycle of length :
HAMILTONIAN CYCLE: (HC) Is there a cycle through a given graph such that every vertex is visited exactly once?
At first, this problem seems to be similar to the search for an Eulerian circuit, but it is not. It belongs to the NP-complete problems (see Chap. 4) and is, in general, not decidable from local considerations. An exception is given in the case of highly connected graphs:
Theorem: If is a graph of order such that for all vertices in , then is Hamiltonian (i. e., it has a Hamiltonian cycle).
We do not give a proof, we just state that the theorem is not sufficient to say anything about our specific sample given in Fig. 2. There are vertices of degree 2 and 3, which are smaller than .
The search for Hamiltonian cycles is closely related to the already mentioned traveling-salesman problem (TSP), which is defined on a weighted graph. The total weight of a subgraph is the sum of the weights of all its edges. In TSP we are looking for the Hamiltonian cycle of minimum weight.
3 Minimum spanning trees
Let us come to the next problem. This time you have to plan a railway network in a country having no trains but many towns which are to be connected. The country has financial problems and asks you to design the cheapest possible network, providing you with the information of which pairs of towns can be directly connected, and at what cost – i. e. they give you a weighted graph. You must find a connected subgraph containing each town to enable travel from one town to another. It is also clear that loops increase the total cost. The most expensive edge in a loop can be deleted without disconnecting some towns from others. But how can one find the globally optimal solution?
Before answering this, we have to go through some definitions:
Definition 1.3.
tree, forest
A tree is a connected cycle-free graph.
A forest is a graph which has only trees as connected
components, see, e. g., Fig. 1.3.
[htb]
A forest is made of trees.
Some easy-to-prove properties of trees are given here:
Theorem: A tree of order has size .
Proof 1.4.
Start with one isolated vertex, add edges. Since there are no cycles, every edge adds a new vertex.
Corollary: Every tree of order contains at least two vertices of degree 1 (leaves).
Proof 1.5.
Assume the opposite, i. e., that there are at least vertices of degree at least 2. We thus find
On the other hand, we have
since every edge is counted twice. This produces a contradiction to the theorem.
To approach our railway-network problem, we need two further definitions.
Definition 1.6.
(Minimum) spanning tree/forest
-
•
Let be a connected graph of order . A spanning tree is a cycle-free subgraph of order having maximum size , i. e., the spanning tree is still connected.
-
•
If is weighted, a spanning tree of minimum weight is called an minimum spanning tree (or economic spanning tree).
-
•
For a general graph, a (minimum) spanning forest is the union of all (minimum) spanning trees for its different connected components.
Due to the maximum size condition of a spanning tree, the connected components of a graph and of its spanning forest are the same. Spanning trees can be constructed using algorithms which calculate connected components, see Sec. 1. Minimum spanning trees obviously fulfil all requirements to our railway network, and they can be constructed in a very simple way using Prim’s algorithm, which is presented in Sec. 3.
4 Edge covers and vertex covers
Now we introduce edge and vertex covers. Both problems are similar to each other, but they are fundamentally different with respect to how easily they can be solved algorithmically. This we have already seen for Eulerian circuits and Hamiltonian cycles. The vertex-cover problem will serve as the prototype example in this book. All concepts, methods and analytical techniques will be explained using the vertex-cover problem. We begin here with the basic definitions, but additional definitions, related to vertex-cover algorithms, are given in Sec. 6.1.
For a graph , an edge cover is a subset of edges such that each vertex is contained in at least one edge . Each graph which has no isolated vertices has an edge cover, since in that case itself is an edge cover. A minimum edge cover is an edge cover of minimum cardinality . In Fig. 4 a graph and a minimum edge cover are shown. A fast algorithm which constructs a minimum edge cover can be found in Ref. [3].
[ht]
A graph and a minimum edge cover (left) and a minimum vertex cover (right). The edges/vertices belonging to the cover are shown in bold.
The definition of a vertex cover is very similar. It is a subset of vertices such that each edge contains at least one vertex out of , i. e., or . Note that itself is always a vertex cover. A minimum vertex cover is an vertex cover of minimum cardinality .
Vertex covers are closely related to independent sets and cliques. An independent set of a graph is a subset of vertices, such that for all elements , there is no edge . A clique is a subset of vertices, such that for all elements there is an edge .
Theorem: For a given graph and a subset the following three statements are equivalent.
-
(A)
is a vertex cover of .
-
(B)
is an independent set of .
-
(C)
is a clique of the complement graph (see definition on page • ‣ 1).
Proof 1.7.
(A B)
Let be a vertex cover, and . We assume that there is an edge . Since
, this is an edge with both vertices not in , and
is not a vertex cover. This is a contradiction! Hence, there
cannot be an edge , and is an
independent set.
(B C)
Let be an independent set, and
. By definition, there is no edge , and so there is an edge . Therefore, is a clique of .
(C A)
Let be a clique of , and
. This means by definition of
. Thus, we have or because is a clique. Hence, or
. By definition of vertex cover, is a vertex cover.
The minimum vertex cover is a vertex cover of minimum
cardinality. From the theorem above, for a minimum vertex cover ,
is a maximum independent set of and a maximum
clique of . In Fig. 4, a graph together with its
minimum vertex cover is displayed. Related to the minimization problem
is the following decision problem, for given integer :
VERTEX COVER (VC): Does a given graph have a vertex cover with ?
In Chap. 4 we will see that VC is a so-called NP-complete problem, which means in particular that no fast algorithm for solving this problem is known – and not even expected to be able to be constructed. This proposition and its relation to statistical physics will be the main subject of this book.
5 The graph coloring problem
The last problem which we discuss in this section is a scheduling problem. Imagine you have to organize a conference with many sessions which, in principle, can take place in parallel. Some people, however, want to participate in more than one session. We are looking for a perfect schedule in the sense that every one can attend all the sessions he wants to, but the total conference time is minimum.
The mapping to an undirected graph is the following: The sessions are considered as vertices. Two of them are connected by an edge whenever there is a person who wants to attend both. We now try to color the vertices in such a way that no adjacent vertices carry the same color. Therefore we can organize all those sessions in parallel, which have the same color, since there is nobody who wants to attend both corresponding sessions. The optimal schedule requires the minimum possible number of colors.
The problem is an analog to the coloring of geographic maps, where countries correspond to vertices and common borders to edges. Again we do not want to color neighboring countries using the same color. The main difference is the structure of the graph. The “geographic” one is two-dimensional, without crossing edges – the so-called planarity of the graph makes the problem easy. The first graph is more general, and therefore more complicated. Again, the problem becomes NP-complete.
Let us be more precise:
Definition 1.8.
-coloring, chromatic number, -core
-
•
A -coloring of is a mapping such that for all edges .
-
•
The minimum number of needed colors is called the chromatic number of .
-
•
The maximal subgraph, where the minimum degree over all vertices is at least , is called the -core.
The smallest graph which is not -colorable is the complete graph of order and size , i. e., all pairs of vertices are connected. Complete graphs are also called cliques. For this is a triangle, for a tetrahedron.
Before analyzing the -coloring problem, a linear-time algorithm for constructing the -core is introduced. The idea of the algorithm is easy, it removes all vertices of degree smaller than , together with their incident edges. The reduced graph may have new vertices of degree smaller than , which are removed recursively, until a subgraph of minimum degree at least is obtained. For obvious reasons the -core is obtained: No vertex out of the -core can be removed by the algorithm, so the final state is at least as large as the -core. By the maximality of the latter, both have to be equal. The input to the algorithm presented below is the initial graph , the output is its -core:
algorithm core() | |||
begin | |||
if min then | |||
return ; | |||
else do | |||
begin | |||
; | |||
; | |||
; | |||
return core(); | |||
end | |||
end |
Theorem: A graph is -colorable if and only if its -core is -colorable.
Proof 1.9.
() A coloring of the full graph is obviously a coloring of every subgraph.
() Construct the -core by the core-algorithm, but keep track of the order in which vertices are removed. Now take any -coloring of the core. Reconstruct the full graph by adding the removed vertices in inverse order. Directly after adding, the vertices have degree smaller than . Their neighbors use less than colors, i. e., the added vertex can be colored. In this way, every coloring of the -core can be recursively extended to a coloring of the full graph.
[htb]
The left graph is the tetrahedron which is not 3-colorable, the letters indicate the different colors of a 4-coloring. The right graph also has fixed degree 3, but is colorable with three colors.
This shows that the hard part of -coloring a graph consists in coloring its -core, i. e., the existence of a non-trivial -core is necessary, but not sufficient for -uncolorability, see, e. g., the examples given in Fig. 1.9. This also leads to
Corollary: Every graph having at most vertices of degree at least is -colorable.
In the beginning of this section we have also considered the coloring of geographic maps – or planar graphs, i. e., graphs which can be drawn in a plane without crossing edges. For these graphs, the chromatic number can be found easily, using the following famous theorem:
Theorem: Every planar graph is 4-colorable.
This had already been conjectured in 1852, but the final solution was only given in 1976 by Appel and Haken [4]. Their proof is, however, quite unusual: Appel and Haken “reduced” the original question to more than 2000 cases according to the graph structure. These cases were finally colored numerically, using about 1200 hours of computational time. Many mathematicians were quite dissatisfied by this proof, but up to now nobody has come up with a “hand-written” one.
On the other hand, it is easy to see that 3 colors are in general not sufficient to color a planar graph. The simplest example is the 4-clique , which is planar, as can be seen in Fig. 1.9.
6 Matchings
Given a graph , a matching is a subset of edges, such that no two edges in are incident to the same vertex [5, 6], i. e., for all vertices we have for at most one edge . An edge contained in a given matching is called matched, other edges are free. A vertex belonging to an edge is covered (or matched) others are M-exposed (or exposed or free).If is matched, then and are called mates.
A matching of maximum cardinality is called maximum-cardinality matching. A matching is perfect if it leaves no exposed vertices, hence it is automatically a maximum-cardinality matching. On the other hand, not every maximum-cardinality matching is perfect.
The vertex set of a bipartite graph can be subdivided into two disjoint sets of vertices, say and , such that edges in the graph only connect vertices in to vertices in , with no edges internal to or . Note that nearest-neighbor hypercubic lattices are bipartite, while the triangular and face-centered-cubic lattices are not bipartite. Owing to the fact that all cycles on bipartite graphs have an even number of edges, matching on bipartite graphs is considerably easier than matching on general graphs. In addition, maximum-cardinality matching on bipartite graphs can be easily related to the maximum-flow problem [7, 8, 9], see Sec. 11.5.
Example 1.10.
Matching
[htb]
Example graph for matching, see text.
In Fig. 1.10 a sample graph is shown. Please note that the graph is bipartite with vertex sets and . Edges contained in the matching are indicated by thick lines. The matching shown in the left half is . This means, e. g., edge is matched, while edge is free. Vertices 1,2,4 and 5 are covered, while vertices 3 and 6 are exposed.
In the right half of the figure, a perfect matching is shown, i. e., there are no exposed vertices.
Having a weighted graph , we consider also weighted matchings, with the weight of a matching given by the sum of the weights of all matched edges. is a maximum-weight matching if its total weight assumes a maximum with respect to all possible matchings. For perfect matchings, there is a simple mapping between maximum-weight matchings and minimum-weight matchings, namely: let , where is the weight of edge and . A maximum perfect matching on is then a minimum perfect matching on .
A good historical introduction to matching problems, the origins of which may be traced to the beginnings of combinatorics, may be found in Lovász and Plummer [6]. Matching is directly related to statistical mechanics because the partition function for the two-dimensional Ising model on the square lattice can be found by counting dimer coverings (= perfect matchings) [6]. This is a graph enumeration problem rather than an optimization problem as considered here. As a general rule, graph enumeration problems are harder than graph-optimization problems.
[htb]
(Left): A bipartite graph with a matching. An alternating path (shaded) starts and ends at exposed vertices, and alternates between unmatched (thin) and matched (thick) edges. (Right): Interchanging matched and unmatched edges along an alternating path increases the cardinality of the matching by one. This is called augmentation and is the basic tool for maximum-matching algorithms. In this example, the augmentation yields a maximum-cardinality matching, even a perfect matching.
The ground state calculation of planar spin glasses is equivalent to the minimum-weight perfect matching problem on a general graph, see Sec. 11.7. Maximum/minimum (perfect) matching problems on general graphs are algorithmically more complicated than on bipartite graphs, see, e. g., Refs [10, 11], but still they can be solved in a running time increasing only polynomially with the system size. These matching algorithms rely on finding alternating paths , which are paths along which the edges are alternately matched and unmatched, see Fig. 6.
2 Basic graph algorithms
In this section, we present basic graph algorithms, which are related to finding the connected components of a graph. First, we explain two different strategies, the depth-first search and the breadth-first search. In addition to yielding the connected components, they construct also spanning tress. Then we explain how the strongly connected components of directed graphs can be obtained by modifying the depth-first search. At the end we show, for the case of weighted graphs, that minimum-weight spanning tress can be found using a simple algorithm by Prim. Another fundamental type of graph algorithm is the shortest-path algorithm, which we explain later on in Sec. 11.4.
1 Depth-first and breadth-first search
For a given graph , we want to determine its connected components. There are two basic search strategies, depth-first search (DFS) and breadth-first search (BFS), which are closely related.
The main work of the first algorithm is done within the following procedure depth-first(), which starts at a given vertex and visits all vertices which are connected to . The main idea is to perform recursive calls of depth-first() for all neighbors of which have not been visited at that moment. The array comp is used to keep track of the process. If comp vertex has not been visited yet. Otherwise it contains the number (id) of the component currently explored. The value of is also passed as a parameter, while the array comp is passed as a reference, i. e., it behaves like a global variable and all changes performed to in a call to the procedure persist after the call is finished.
procedure depth-first(, , [ref.] comp, ) | |||
begin | |||
comp[]:=; | |||
for all neighbors of do | |||
if comp[] = 0 then | |||
depth-first(, , comp, ); | |||
end |
To obtain all connected components, one has to call depth-first() for all vertices which have not been visited yet. This is done by the following algorithm.
algorithm components() | ||
begin | ||
initialize comp for all ; | ||
; | ||
while there is a vertex with comp=0 do | ||
depth-first(, , comp, ); ; | ||
end |
For any vertex , when the procedure calls itself recursively for a neighbor , it follows the edge . Since no vertex is visited twice, those edges form a spanning tree of each connected component. We call those edges tree edges and the other edges are known as back edges. The algorithm tries to go as far as possible within a graph, before visiting further neighbors of the vertex in which the search started. It is for this reason that the procedure received its name. Thus, the spanning tree is called the depth-first spanning tree and the collection of the spanning trees of all connected components is a depth-first spanning forest. In the next section, we will use the depth-first spanning trees to find the strongly connected components in a directed graph.
Example 2.1.
Depth-first spanning tree As an example, we consider the graph shown on the left of Fig. 2.1. We assume that the algorithm first calls depth-first() for vertex 1, hence is set.
[ht]
A sample graph (left). The number close to the vertices indicates a possible order in which the vertices are visited during a depth-first search. On the right, the resulting depth-first spanning tree is shown.
We assume that vertex is the first neighbor of vertex 1 encountered in the for loop. Hence depth-first is called for vertex , where is set. Here, in the for loop, vertex 1 may be encountered first, but it has already been visited (), hence nothing happens. In the next iteration the second neighbor, vertex is encountered. Now depth-first() is called for vertex and there is assigned. We assume that vertex 7 is the first vertex encountered in the loop over all neighbors of vertex 4. Therefore, depth-first() is called next, leading to two more recursive calls of depth-first(). The full recursive hierarchy of calls appears as follows (we show only the parameter for vertex ):
depth-first() | |||||
depth-first() | |||||
depth-first() | |||||
depth-first() | |||||
depth-first() | |||||
depth-first() | |||||
depth-first() |
The deepest point in the recursion is reached for vertex 3. All its neighbors, vertices 1, 4 and 6 have already been visited, hence the procedure returns here without further calls. At this point only vertex 5 has not been visited, hence it is visited when iterating over the other neighbors of vertex 4. The order in which the vertices are visited is indicated in Fig. 2.1 and the resulting depth-first spanning tree is also shown.
During a run of the algorithm, for each vertex all neighbors are accessed to test whether it has already been visited. Thus each edge is touched twice, which results in a time complexity of .
The depth-first search can also be adapted for directed graphs. In this case, being at vertex , one follows only edges (), i. e., which point in a forward direction. This means that the resulting depth-first spanning trees may look different. Even the vertices contained in a tree may differ, depending on the order in which the vertices are visited in the outer loop (as in components() for the undirected case), as we will see in the example below. This means that components are not well defined for directed graphs, because they depend on the order in which the vertices are treated. Instead, one is interested in calculating the strongly connected components, which are well defined. The corresponding algorithm is presented in the next section. There we will need the the reverse topological order, also called postorder. This is just the order in which the treatment of a vertex finishes during the calculation of the depth-first spanning tree, i. e., the order in which the calls to the procedure, with as argument, terminate.
The algorithm reads as follows, it is only slightly modified with respect to the undirected case. The postorder is stored in array , which is passed as reference, i. e., all modifications to the values are also effective outside the procedure. We also need a counter , also passed by reference, which is used to establish the postorder. The array , passed also by reference, keeps track of which vertices have already been visited and stores the identification numbers of the trees in which the vertices are contained, corresponding to the array used for the undirected case.
procedure depth-first-directed(, , [ref.] , , [ref.] , [ref.] ) | |||
begin | |||
; | |||
for all with do | |||
if tree[] = 0 then | |||
depth-first-directed(, , , , , c); | |||
; | |||
; | |||
end |
The main subroutine, finding all connected depth-first spanning trees and establishing the reverse topological order, reads as follows.
algorithm postorder() | ||
begin | ||
initialize tree for all ; | ||
; | ||
; | ||
while there is a vertex with =0 do | ||
depth-first-directed(, , , , , ); t:=t+1; | ||
end |
The vertices, for which depth-first-directed() is called inside the loop in postorder(), i. e., the vertices where the construction of a tree starts, are called roots of the depth-first spanning trees. They are the vertices which receive the highest numbers for each tree. Vertices of other trees, which are visited earlier receive lower numbers, vertices of trees being visited later will receive higher numbers than all vertices of the current tree.
Example 2.2.
Depth-first spanning tree of a directed graph We consider the graph shown in Fig. 2.2. [ht]
A sample directed graph.
We assume that in postorder() vertex 1 is first considered. Vertex 1 has one neighbor, hence depth-first-directed() will be called for vertex 2, in which the procedure is called for vertex 3. Vertex 3 has one neighbor in the forward direction, vertex 1, which has already been visited, hence no call is performed here. This means that the procedure finishes for vertex 3, and is assigned. Since all neighbors of vertex 2 have been visited, this call also finishes and is assigned. Next the same thing happens for vertex 1, resulting in . Hence, the algorithm returns to the top level, to postorder().
Now, we assume that depth-first-directed is called for vertex 4, and that its neighbors are processed in the order 3,5,6,8. Vertex 3 has already been visited. The call of depth-first-directed() for vertex 5 leads to a call of the procedure for its unvisited neighbor vertex 7. The call for vertex 8 itself calls the procedure for vertex 9. In total the following calling hierarchy is obtained, only the passed values for the vertex are shown.
depth-first-directed() | ||
depth-first-directed() | ||
depth-first-directed() | ||
depth-first-directed() | ||
depth-first-directed() | ||
depth-first-directed() | ||
depth-first-directed() | ||
depth-first-directed() | ||
depth-first-directed() |
The resulting depth-first spanning forest is shown in Fig. 2.2 together with the values for the reverse topological order. The roots of the trees are always shown at the top. [ht]
On a possible depth-first spanning forest of the graph from Fig. 2.2. The numbers close to the vertices denote the values of the reverse topological order.
If the vertices are treated in a different order, then the resulting depth-first spanning forest might look different. When, e. g., vertex 4 is considered first, then all vertices will be collected in one tree. The resulting tree, assuming that the neighbors of vertex 4 are considered in the order 8,6,5,3, is shown in Fig. 2.2. [ht]
Another possible depth-first spanning tree of the graph from Fig. 2.2. The numbers close to the vertices denote the values of the reverse topological order.
Now we turn back to undirected graphs. A similar algorithm to a depth-first search is an algorithm, which first visits all neighbors of a vertex before proceeding with vertices further away. This algorithm is called a breadth-first search. This means that at first all neighbors of the initial vertex are visited. This initial vertex is the root of the breadth-first spanning tree being built. These neighbors have distance one from the root, when measured in terms of the number of edges along the shortest path from the root. In the previous example in Fig. 2.1, the edge would be included in the spanning tree, if it is constructed using a breadth-first search, as we will see below. In the next step of the algorithm, all neighbors of the vertices treated in the first step are visited, and so on. Thus, a queue111A queue is a linear list, where one adds elements on one side and removes them from the other side. can be used to store the vertices which are to be processed. The neighbors of the current vertex are always stored at the end of the queue. Initially the queue contains only the root. The algorithmic representation reads as follows, denotes the distance of vertex from the root and is the predecessor of in a shortest path from , which defines the breadth-first spanning tree.
algorithm breadth-first search(, [ref.] ) | ||||
begin | ||||
Initialize queue ; | ||||
Initialize ; (undefined) for all other vertices; | ||||
; | ||||
Initialize ; | ||||
while not empty | ||||
begin | ||||
Remove first vertex of ; | ||||
for all neighbors of do | ||||
if then | ||||
begin | ||||
; | ||||
; | ||||
; | ||||
add at the end of ; | ||||
end | ||||
end | ||||
end |
Also for a breadth-first search, for each vertex all neighbors are visited. Thus each edge is again touched twice, which results in a time complexity of . To obtain the breadth-first spanning forest of a graph, one has to call the procedure for all yet unvisited vertices inside a loop over all vertices, as in the algorithm components() presented above.
Example 2.3.
Breadth-first search We consider the same graph as in the example above, shown now in Fig. 2.3. Initially the queue contains the source, here 1 again and all values are “undefined” (-1), except .
,
[ht]
A sample graph (left). The number close to the vertices indicate a possible order in which the vertices are visited during a breadth-first search. On the right the resulting breadth-first spanning tree is shown.
While treating vertex 1, its neighbors, vertices 2 and 3, are added to the queue, thus . They have a distance 1 from the source ().
, ,
Next vertex 2 is processed. It has two neighbors, vertices 1 and 4, but vertex 1 has been visited already ), thus only vertex 4 is added to with , . After this iteration the situation is as follows:
, , ,
The treatment of vertex 3 adds vertex 6 to the queue (, ). At the beginning of the next iteration vertex 4 is taken. Among its four neighbors, vertices 5 and 7 have not been visited. Thus and . Now all values of the and arrays are set. Finally, vertices 6,5 and 7 are processed, without any change in the variables.
The resulting breadth-first spanning tree is shown on the right of Fig. 2.3. It is also stored in the array of shortest paths to the source, e. g., a shortest path from vertex 7 to vertex 1 is given by the iterated sequence of predecessors: .
2 Strongly connected component
As we recall from Sec. 1, the strongly connected components of a directed graph are the maximal subsets of vertices in which, for each pair , a directed path from to and a directed path from to , exists in . As we will show here, they can be obtained by two depth-first searches.
The basic idea is as follows. First one performs a depth-first search on , obtaining the depth-first spanning forest and the reverse topological order in the array . Next, once constructs the reverse graph , which is obtained by using the same vertices as in and with all edges from reversed
(1) |
Then we compute the depth-first spanning forest of , but we treat the vertices in the main loop in decreasing values of the reverse topological order obtained in the first computation of the depth-first order of . In particular, we always start with the vertex having received the highest number. The trees of the depth-first spanning forest obtained in this way are the strongly connected components of . The reason is that, for each tree, the vertices with highest number are those from where all vertices of a depth-first tree can be reached, i. e., the roots of the trees. When starting the depth-first search at these vertices for the reverse graph, graph one is able to visit the vertices, from which one is able to reach the root in the original graph. In total these are the vertices from which one can reach the root and which can be reached starting from the root, i. e., they compose the strongly connected components. A detailed proof will be given below. The algorithm can be summarized as follows:
algorithm scc() | |||
begin | |||
initialize tree for all ; | |||
; ; | |||
while there is a vertex with =0 do | |||
depth-first-directed(, , , , , ); t:=t+1 | |||
calculate reverse graph ; | |||
initialize tree for all ; | |||
; | |||
; | |||
for all in decreasing value of do | |||
if =0 do | |||
depth-first-directed(, , , , , ); t:=t+1; | |||
end |
Example 2.4.
Strongly connected component As an example, we consider the graph from Fig. 2.2. We assume that the reverse topological order is as obtained in the first example run which was shown on page 2.2, hence the vertices ordered in decreasing numbers of the reverse topological order are
In this order, the depth-first search is applied to the reverse graph , graph which is shown in Fig. 2.4.
Hence, when calling depth-first-directed(, 4, , , , ), the vertices 7, 5, and 6 are visited recursively in this order, before the call with terminates. Next, in the main loop with , the procedure is called for vertex , which has the second highest value in , the vertices and are processed. For the third () iteration, depth-first-directed() is called for vertex 1, resulting in the visits of also vertices 3 and 2. The resulting depth-first spanning forest is shown on the right.
This means that we have obtained three trees, corresponding to the three strongly connected components , and .
The algorithm consist of two loops over vertices, containing calls to depth-first-directed(). Each loop takes time , see Sec. 1. Note that one can obtain the vertices in decreasing reverse topological order, by writing each vertex in an array after its call to depth-first-directed() has finished. For brevity, we have not included this array in the above algorithm. This means that one can perform the for loop in scc() simply by going through the array in reverse order, i. e., without additional time cost. Since also calculating the reverse graph graph can be done in , the full algorithm has a running time . There are variants of the algorithm, which require only one calculation of the depth-first spanning forest instead of two, also no calculation of the reverse graph occurs there. Instead, they require updating of additional data fields, hence they are a bit harder to understand. The reader interested in these algorithms should consult the standard literature [12, 13, 14].
We close this section by showing that the above algorithm does indeed yield the strongly connected components of a directed graph. Note that the strongly connected components of the reverse graph graph are exactly the same as those of the graph itself.
Proof 2.5.
Assume that two vertices and are mutually reachable, i. e., are connected
by paths. Hence, they are mutually reachable in the reverse graph. This means
that during the second calculation of the forest, they will be in the
same tree.
Now we assume that and are in the same tree of the depth-first forest calculation of . Let be the root of this tree, i. e., the vertex for which depth-first-directed() has been called on the top level in the for loop. Since the for loop is performed in decreasing order of the values, this means that has the highest value of the tree. This means in particular and (*).
We perform the proof by raising a contradiction. We assume that and are not in the same strongly connected component.
Since and are in the same tree with root for , there must paths from the root to and from to in the reverse graph graph , hence there must be paths from to and from to in . Since and are assumed not to be in the same strongly connected component, either there is no path from to in or there is no path from to in .
Without loss of generality, we consider the first case . There are two possibilities:
-
a)
is visited before in the calculation of the depth-first forest of . But then, because there is a path from to in , the call to depth-first-directed() for would finish before the call for , hence we would have . This is a contradiction to (*)!
-
b)
is visited before . Since there is no path from to , vertex will still be unvisited, when the call for has been finished, hence we will have again . This is a contradiction to (*)!
In the same way, we can raise a contradiction when assuming that path does not exist in . This means in total that and must be in the same strongly-connected component.
3 Minimum spanning tree
The algorithm used to construct a minimum spanning tree of a given graph (see Sec. 3 for a definition) is greedy. This means that at every step the algorithm takes the least expensive decision. In contrast to the TSP-algorithm presented in Chap. 2, a global minimum is guaranteed to be found. The basic idea of Prim’s algorithm is that one starts with the edge of minimal weight, and goes on adding minimal edges connected to the already constructed subtree, unless a cycle would result:
algorithm Prim(G) | ||
begin | ||
choose : ; | ||
; | ||
; | ||
; | ||
; | ||
while do | ||
begin | ||
choose : and ; | ||
; | ||
; | ||
; | ||
; | ||
end | ||
return ; | ||
end |
The action of Prim’s algorithm is illustrated in Fig. 3. One can easily verify that it produces in fact a minimum spanning tree: Imagine, that this is not the case, i. e., in the algorithm you have, for the first time, added a wrong edge at the th step. Now imagine that you have a minimum spanning tree coinciding with the tree constructed in Prim’s algorithm in the first selected edges, but not containing . If you add edge to the minimum spanning tree, you introduce a cycle, which, by Prim’s algorithm, contains at least one edge of higher weight. Deleting the latter thus gives a new spanning tree of smaller weight, which is a contradiction to the minimality of the initial spanning tree.
Since each edge is chosen at most one, the while loop is performed times. In a simple version, choosing the edge with minimum weight requires a loop over all edges (), while a more refined version could use a priority queue [12, 13, 14], such that the choose operation takes only time, leading to a total of running time.
[ht]
Illustration of Prim’s algorithm. The graph contains five vertices numbered from 1 to 5. The numbers along the edges denote the edge weights. The current edges contained in the spanning tree are shown in bold. From (a), starting with the lowest cost edge, to (d), successively new edges are added until a minimum spanning tree is reached.
3 Random graphs
1 Two ensembles
The basic idea of random-graph theory is to study ensembles of graphs instead of single, specific graph instances. Using probabilistic tools, it is sometimes easier to show the existence of graphs with specific properties, or, vice versa, to look at how a typical graph with given properties (e. g., order, size, degrees…) appears.
The simplest idea goes back to a seminal paper published by Erdős and Rényi in 1960 [15]. They assumed all graphs of the same order and size to be equiprobable. There are mainly two slightly different ensembles used in the field:
The ensemble contains all graphs of vertices and edges. The measure is flat, i. e., every graph has the same probability, see, e. g., Fig. 1. Note that all graphs obtained from a given graph by permuting the vertices are different graphs, i. e., they are counted individually.
[htb]
These two graphs are equiprobable in , even if their structure is quite different. Whereas the left graph is a connected tree, the right one is not connected and contains a cycle.
The ensemble , with , contains graphs with vertices. For every vertex pair an edge is drawn independently with probability . For , the graph has no edges, for , the graph is complete (). On average, the number of edges for given is
(2) |
where the over-bar denotes the average over . This ensemble is analytically easier to handle, so we mainly work with .
The specific case can also be considered as the random ensemble of graphs: All graphs of vertices are equiprobable, independently of their edge numbers.
One important type of statement is that a -graph fulfils almost surely (or with probability one) some condition . This expression means that, for , the probability that a graph drawn from fulfils this condition , converges to one.
2 Evolution of graphs
Sometimes, it is very instructive to imagine the ensemble via an evolutionary process of graphs of vertices which, with time, get more and more edges. This can be realized in the following way. We take , and for all , , we independently draw a random number being equally distributed in . Initially the graph has no edges. Now, we start to grow . Whenever it exceeds a number , an edge between vertices and is added. Thus, at time , the graph belongs to . There are some interesting stages in this evolution:
-
•
: The first isolated edges appear.
-
•
: The first vertices have degree 2, i. e., the first edges have a common vertex.
-
•
any : The graph is almost surely a forest.
-
•
: The average vertex degree stays finite for , first cycles appear, the first macroscopic (i. e., of order ) subgraph appears, macroscopic -cores appear.
-
•
: The graph becomes connected.
-
•
: The graph becomes Hamiltonian.
For the proof see the book by Bollobás mentioned on page • ‣ ‣ Chapter 0 Introduction to graphs.
3 Finite-connectivity graphs: The case toctoc
The most interesting case is given by , where the medium size of the graph grows linearly with the graph order . In this section, we first discuss the fluctuations of the total edge number , and some local properties like degrees and the existence of small cycles. In the following two sections we finally switch to global properties. We discuss random-graph percolation which describes a phase transition from graphs having only small connected components, even for , to graphs also having one giant component which unifies a finite fraction of all vertices, i. e., whose order also grows linearly with the graph order . The last subsection discusses the sudden emergence of a -core.
The number of edges
For a graph from , every pair of vertices becomes connected by an edge with probability , and remains unlinked with probability . In contrast to the -ensemble, the total number of edges is a random variable and fluctuates from sample to sample. Let us therefore calculate the probability of it having exactly edges. This is given by
(3) |
The combinatorial prefactor describes the number of possible selections of the edges out of the distinct vertex pairs, the second factor gives the probability that they are in fact connected by edges, whereas the last factor guarantees that there are no further edges. In the limit of large , and for , where , we use
(4) |
and , hence the above expression can be asymptotically approximated by
(5) |
Plugging in , this asymptotically leads to a Poissonian distribution with mean ,
(6) |
The fluctuations of the edge number can be estimated by the standard deviation of ,
(7) |
We first calculate
(8) | |||||
In the third line, we have eliminated the cases which vanish due to the factor , in the fourth line we have introduced which runs from 0 to . The sum can be performed and gives . Using Eq. (7) we thus find
(9) |
which is a special case of the central limit theorem. The relative fluctuations decay to zero for , see Fig. 3. In this limit, the sample-to-sample fluctuations of the edge number become less and less important, and the ensemble can be identified with for most practical considerations.
[htb]
The distribution of edge numbers for , rescaled by . The distributions obviously sharpen for increasing .
The degree distribution
Let us now discuss the degrees of the graph. We are interested in the probability that a randomly chosen vertex has exactly degree . The set of all is called the degree distribution. It can be easily calculated:
(10) |
The meaning of the terms on the right-hand side is the following: The factor enumerates all possible selections for potential neighbors. Each of these vertices is connected to the central vertex with probability , whereas the other vertices are not allowed to be adjacent to the central one, i. e., they contribute a factor each. In the large- limit, where any fixed degree is small compared with the graph order , we can continue in an analogous way to the last subsection and find
(11) | |||||
i. e., also the degrees are distributed according to a Poissonian distribution. It is obviously normalized, and the average degree is
(12) | |||||
This was clear since the expected number of neighbors to any vertex is . Note also that the fluctuation of this value are again given by the standard deviation , which, however, remains comparable to if . The degree fluctuations between vertices thus also survive in the thermodynamic limit, there is, e. g., a fraction of all vertices which is completely isolated.
If we randomly select an edge and ask for the degree of one of its end-vertices, we obviously find a different probability distribution , e. g., degree zero cannot be reached (). This probability is obviously proportional to as well as to , by normalization we thus find
(13) |
for all . The average degree of vertices selected in this way equals , it includes the selected edge together with, on average, additional excess edges. The number of these additional edges will be denoted as the excess degree of the vertex under consideration.
Cycles and the locally tree-like structure
The degrees are the simplest local property. We may go slightly beyond this and ask for the average number of small subgraphs. Let us start with subtrees of vertices which thus have edges. We concentrate on labeled subtrees (i. e., the order in which the vertices appear is important) which are not necessarily induced (i. e., there may be additional edges joining vertices of the tree which are not counted). Their expected number is proportional to
(14) |
combinatorial factors specifying specific edges out of the possible ones, are omitted. This number thus grows linearly with the graph order . If, on the other hand, we look to cycles of finite length , we have to find edges. The above expression takes an additional factor , the expected number of cycles is thus of , i. e., the number of triangles, squares, etc. stays finite even if the graph becomes infinitely large! This becomes more drastic if one looks to cliques with , these become more and more likely to be completely absent if becomes large. Thus, if we look locally to induced subgraphs of any finite size , these are almost surely trees or forests. This property is denoted as locally tree-like.
There are, however, loops, but these are of length [16]. In the statistical physics approach, we will see that these loops are of fundamental importance, even if they are of diverging length.
Another side remark concerns the dimensionality of the graph, i. e., the possibility of “drawing” large graphs in a finite-dimensional space. If you look to any -dimensional lattice, the number of neighbors up to distance grows as . On the other hand, in a tree of fixed average degree, this number is growing exponentially! In this sense, random graphs have to be considered to be infinite dimensional. This sounds strange at first, but finally explains the analytical tractability which will be observed later in this book.
4 The phase transition: Emergence of a giant component
From Sec. 2 we know that random graphs with are almost surely not connected. What can we say about the components?
Having in mind the growth process described above, we may imagine that for small there are many small components, almost all of them being trees. If increases, we add new edges and some of the previously disconnected components now become connected. The number of components decreases, the number of vertices (order) of the components grows. Concentrating on the largest component of a graph , the following theorem was demonstrated in 1960 by Erdős and Rényi [15]:
Theorem: Let and drawn from .
Set .
(i) If then we find almost surely
(ii) If we almost surely have
with being the unique solution of
All smaller components are of order .
This theorem makes a very powerful statement: As long as , all components have order up to . This changes markedly if . There appears one giant component connecting a finite fraction of all vertices, but all the other components are still small compared to the giant one, they have only vertices. This means that at the system undergoes a phase transition. In contrast to physical phase transitions, it is not induced by a change in temperature, pressure or other external control parameters, but by the change of the average vertex degree , i. e., by a structural parameter of the graph. Due to the obvious analogy to percolation theory [17], this phase transition is also called random-graph percolation in the literature.
This theorem is one of the most fundamental results of random-graph theory, but we do not present a complete proof. There is, however, a simple argument that the component structure changes at . It is based on the locally tree-like structure of all components, and is presented in the limit .
If we select any vertex, on average it will have neighbors. According to Eq. (13), each of these will have additional neighbors, the first vertex thus has, on average, second neighbors. Repeating this argument, we conclude that the expected number of th neighbors equals (A vertex is called a th neighbor of a vertex if the minimum path in the graph connecting both contains exactly edges).
Now we can see the origin of the difference for and . In the first case, the prescribed process decreases exponentially, and it is likely to die out after a few steps. If, in contrast, we have , the expected number of th neighbors grows exponentially. Still, there is a finite probability that the process dies out after a few steps (e. g., if dying in the first step, i. e., if there are no neighbors at all), but there is also a finite probability of proceeding for ever.
[htb]
Schematic representation of the iterative solution for the probability that a vertex does not belong to the giant component. The first line shows the self-consistent equation for a vertex reached by a random edge: The black square with the half-edge represents the probability that the vertex reached is not connected to the giant component by one of its excess edges. This can happen because it has no further neighbors, or it is connected to one, two, etc., vertices not connected with the giant component. The second line shows the resulting equation for a randomly selected vertex, as represented by the shaded square.
This argument can be made more rigorous by considering the following iterative construction: Fist we calculate the probability , that a randomly selected end-vertex of a randomly selected link is not connected via other edges with the giant component of the graph. In Figure 4 this is represented by a black square connected to a half-edge. This vertex can either have degree one, i. e., it has no further incident edges which would be able to connect it to the giant component, or it is connected to other vertices which themselves are not connected to the giant component by their excess edges. Having in mind that almost all small connected components are trees, these neighbors are connected with each other only via the selected vertex, and the probability that neighbors are not connected to the giant component equals simply . Using the probability distribution Eq. (13) of degrees of vertices reached by random edges, we thus find:
(15) | |||||
This quantity can thus be determined self-consistently for every value of , and allows us to calculate the probability that a randomly selected vertex does not belong to the giant component. Applying similar arguments to before, this vertex can either be isolated, or connected only to other vertices which, via their excess edges, are not connected to the giant component, see the second line of Fig. 4. We thus find
(16) | |||||
From these equations we see first that, for our random graph, . Plugging this into the last line, we obtain the equation
(17) |
as given in the theorem.
[htb]
Fraction of vertices belonging to the largest component of a random graph, as a function of the average degree . The symbols are numerical data for , averaged always over 100 randomly generated graphs. The full line gives the asymptotic analytical result: Below , the largest component is sub-extensive, above it is extensive.
Let us shortly discuss the shape of . For , with , we also expect to be small, and expand the above equation to second order in :
(18) |
The term cancels on both sides. Dividing by , and keeping only the first order in and , we thus find
(19) |
The relative order of the giant component thus starts to grow linearly in (we say the critical exponent for the giant component equals one), and converges exponentially fast to 1 for larger . The full curve is given in Fig. 4, together with numerical data for finite random graphs.
5 The emergence of a giant toctoc-core
In Sec. 5, we have introduced the -core of a graph as the maximal subgraph having minimum vertex degree of at least . Quite recently, the problem of the existence of a -core in random graphs was solved in a beautiful paper by B. Pittel, J. Spencer and N. C. Wormald [18] by analyzing exactly the linear-time algorithm given there. Here we will give an easily accessible summary of their approach, not including the technical details of the mathematical proofs.
Let us first start with a numerical experiment: We have generated medium-size random graphs with vertices and various average degrees , and we have applied the -core algorithm for and . The results for are not very astonishing: Up to , the 2-core is very small, whereas it starts to occupy a finite fraction of all vertices for . This is consistent with the results on the giant component obtained in the last section: As long as the latter does not exist, almost all vertices are collected in finite trees, and thus do not belong to the 2-core. A small difference in the emergence of the giant component can, however, be seen looking in the vicinity of . Whereas the giant component starts to grow linearly with the distance from the critical point, see Eq. (19), the 2-core emerges with zero slope, see Fig. 5. This means that the critical exponents of both processes appear to differ from each other.
The situation changes dramatically for . At the corresponding threshold , which is monotonously increasing with , the -core appears discontinuously – immediately unifying a finite fraction of all vertices. For , the threshold is found to be . Slightly below this average degree, almost all graphs have no extensive -core at all. At the transition, the order of the -core jumps abruptly to about , i. e., it contains about 27% of all vertices!
[htb]
Fraction of vertices belonging to the -core for (circles) and (diamonds). The numerical data result from a single graph of vertices. The vertical line gives the theoretical value of the 3-core size at the threshold
Wormald’s method
The method of describing this behavior was presented mathematically by Wormald [19], it is, however, well-known and applied in physics under the name of rate equations. It analyzes a slightly modified version of the -core algorithm. In every algorithmic step, only one vertex of degree smaller than is selected randomly and removed from the graph. The quantity calculated in the analysis of Pittel et al. is the degree distribution , as it changes under the algorithmic decimation. This is obviously a perfect candidate for determining the halting point of the algorithm. If for all , the remaining subgraph is the -core.
An important point in the analysis, which will not be justified mathematically here, is that the graph dynamics is self-averaging in the thermodynamic limit . After a certain number of algorithmic steps almost all random graphs have the same degree distribution, which is also almost surely independent of the random order of decimated vertices. Technically, this allows us to average over both kinds of randomness and to determine the average, or expected action of the algorithm.
In the last paragraph, we have already introduced a rescaling of the number of algorithmic steps by introducing the time . This quantity remains finite even in the thermodynamic limit, running initially from to at most , where the full graph would have been removed. Further on, this quantity advances in steps , and thus becomes continuous in the large- limit. The last observation will allow us to work with differential equations instead of discrete-time differences.
After these introductory remarks we can start the analysis by first noting that the total vertex number evolves as , since we remove one vertex per step. Introducing later on the numbers of vertices having neighbors at time , and the corresponding degree distribution , we can write down the expected change of in the st step. It contains two different contributions:
-
•
The first contribution concerns the removed vertex itself. It appears only in the equations for with , because no vertex of higher current degree is ever removed.
-
•
The second contribution results from the neighbors of the removed vertex. Their degree decreases by one.
We thus find the equation below where we explain the meaning of the terms in detail:
(20) |
which are valid for all degrees . Here we have introduced as an indicator for vertices of degree at most , i. e., it equals one if and zero else. The overbar denotes as before the average over the graph, i. e., and . Note that these averages are now, even if not explicitly stated, time dependent. We keep the explicit notation for . All terms have the following form: they are products of how often the corresponding process happens on average in one step, and of the probability that the corresponding process affects a vertex of degree . The first term of the right-hand side of Eq. (20) describes the removal of the selected vertex (i. e., this process happens exactly once within each step), the indicator guarantees that only vertices of degree can be removed. The second term contains the neighbors: On average, there are neighbors, each of them having degree with probability . A loss term stems from vertices having degree before removing one of their incident edges, a gain term from those having degree .
In the thermodynamic limit, the difference on the left-hand side of Eq. (20) becomes a derivative:
(21) | |||||
The last two equations result in a closed set of equations for the degree distribution,
(22) |
which will be solved in the following. First we derive some global equations for averages over . The simplest one can be obtained by summing Eq. (22) over all , which gives the trivial consistency relation . A much more interesting equation results by first multiplying Eq. (22) by , and then summing over all . Introducing the short-hand notation , we find
(23) | |||||
The initial condition is hereby .
The main problem in solving Eqs (21) is, however, that they form an infinite set of non-linear differential equations. A direct solution is therefore far from obvious. Our salvation lies in the fact that the algorithm never directly touches a vertex of degree . These vertices change their properties only via the random removal of one of their incident edges. Therefore they maintain their random connection structure, and their Poissonian shape, only the effective connectivity changes. This can be verified using the ansatz, with being the effective connectivity ():
(24) |
This ansatz introduces a radical simplification. An infinite number of probabilities is parametrized by one single parameter . The validity of this ansatz can be justified by plugging it into Eq. (21) for arbitrary . We obtain for the left-hand side
(25) |
and for the right-hand side
(26) |
They have to be equal for all , and we can compare the components of the monomial of the same order of both sides:
(27) |
The equations thus become closed under ansatz (24), and instead of having an infinite number of equations for the , just one equation for remains. Interestingly, the -dependence in this equation is dropped.
If we compare Eqs (23) and (27), we find
(28) |
which, using the initial conditions, is solved by
(29) |
The function can thus be replaced in Eq. (27), and we get
(30) |
As a further step, we still have to remove and from the last equation. This can be obtained by using normalization, when applying Eq. (24)
(31) | |||||
In the same way, we obtain for the average degree :
(32) |
and
(33) | |||||
Inserting this into Eq. (30), and using Eq. (29) to eliminate , the equation for finally becomes:
(34) |
We have thus succeeded in reducing the infinite set (22) into the single Eq. (34)! Still, this equation is non-linear and thus not easily solvable for arbitrary . The important information about the -core can, however, be obtained even without solving this equation for all times, but by determining only the halting point of the algorithm – which is the -core of the input graph.
Assume that the graph has a giant -core. It contains vertices, where is the halting time of the algorithm. At this point, all remaining vertices have degree , we thus have and . According to (31,33) we therefore have
(35) |
The second equation fixes , whereas itself and thus the order of the giant -core follow directly from the first equation. If there are two or more solutions for one has to choose the largest one which is smaller than . The initial condition for is , and Eq. (34) results in a negative slope, i. e., in a decrease of with time.
The case
Let us first consider the case of colors only. From numerical experiments we have seen that the 2-core of a random graph seems to set in continuously at average degree . Can we confirm this, starting with Eqs (5)?
The self-consistent equation for becomes
(36) |
as represented graphically in Fig. 5. The right-hand side starts in with slope one, and asymptotically tends to one. The left-hand side is a straight line of slope . For the only solution of Eq. (36) is thus given by , which according to the first of Eqs (5) corresponds to , and the 2-core has vanishing size. At , the right-hand side has a smaller slope in the origin, but still diverges for large . The two curves therefore have a second crossing point which, according to the discussion at the end of the last section, has to be selected as the relevant solution. A non-zero , however, implies a non-zero , and the 2-core unifies a finite fraction of all vertices of the random graph.
[htb]
Graphical solution of Eq. (36): The full line shows , the straight lines have slopes with . The solution is given by the largest crossing point between the curves. For the only crossing appears in . For , a second, positive solution exists. It is marked by the arrow.
Note that the non-zero solution of Eq. (36) sets in continuously at . If we fix a slightly larger with , we find
(37) |
Expanding this equation in and we get
(38) |
and thus . For the halting time, and thus for the size of the 2-core, we have
(39) | |||||
The critical exponent for 2-core percolation is thus , which is in perfect agreement with the numerical findings presented at the beginning of this section.
The case
For , the self-consistency equation for becomes
(40) |
see Fig. 5 for the graphical solution. The important difference to the 2-core is that, for , the right-hand side starts with slope zero. A non-zero crossing point developing continuously out of the solution is therefore impossible. In fact, up to , no further crossing point exists, and the existence of a giant component of the random graph is obviously not sufficient for the existence of a giant 3-core. At , however, the two curves touch each other at one point , as marked by the full-line arrow in Fig. 5, and two new solutions appear. The larger one is, as already discussed, the correct one.
[htb]
Graphical solution of Eq. (40): The full line shows , the straight lines have slopes with . The solution is given by the largest crossing point between the curves. For the only crossing appears in . For , two other, positive solutions exist. The correct one is marked by the arrows.
The discontinuous emergence of a new solution in Eq. (40) results also in a discontinuous emergence of the 3-core. As observed in the experiments, the latter jumps at from zero size to about 27% of all vertices. This becomes even more pronounced if we look to larger , e. g., the 4-core appears at and includes vertices, and the 5-core emerges only at and includes even vertices.
Results for random-graph coloring
As an immediate consequence we see that almost all graphs with are colorable with colors, or, formulated differently, that the chromatic number for a graph with is almost surely bounded from above by . It may, of course, be smaller. We know that the existence of a -core is not sufficient to make a graph uncolorable with colors, see Fig. 1.9. As noted in the proof of the theorem on page 1.8, the reversion of the -core algorithm can be used to extend the coloring of the -core to the full graph in linear time. So we see that, even if the problem is hard in the worst case, almost all graphs of can be efficiently colored with only colors.
The analysis given by Pittel, Spencer, and Wormald is very similar to an analysis of a simple linear time algorithm that we give in Chap. 8. In general, the probabilistic analysis of algorithms is able to provide useful bounds on properties of almost all random graphs.
References
- [1] [1]99
- [2] L. Euler, Commentarii Academiae Scientiarum Imperialis Petropolitanae 8, 128 (1736).
- [3] E. L. Lawler, Combinatorial Optimization: Networks and Matroids, (Holt, Rinehard and Winston, New York 1976).
- [4] K. Appel and W. Haken, Discrete Math. 16, 179 (1976).
- [5] R. L. Graham, M. Grötschel, and L. Lovász, Handbook of Combinatorics, (Elsevier Science Publishers, Amsterdam 1995).
- [6] L. Lovász and M. D. Plummer, Matching Theory, (Elsevier Science Publishers, Amsterdam 1986).
- [7] H. Rieger, Ground state properties of frustrated systems, in: J. Kertesz and I. Kondor (eds.), Advances in Computer Simulation, Lecture Notes in Physics 501, (Springer, Heidelberg, 1998).
- [8] M. Alava, P. Duxbury, C. Moukarzel, and H. Rieger, Combinatorial optimization and disordered systems, in: C. Domb and J. L. Lebowitz (eds.), Phase Transitions and Critical Phenomena, 18, 141 (Academic Press, Cambridge 2000).
- [9] A. K. Hartmann and H. Rieger, Optimization Algorithms in Physics, (Wiley-VCH, Berlin, 2001).
- [10] W. J. Cook, W. H. Cunningham, W. R. Pulleyblank, and A. Schrijver, Combinatorial Optimization, (John Wiley & Sons, New York 1998).
- [11] B. Korte and J. Vygen, Combinatorial Optimization – Theory and Algorithms, (Springer, Heidelberg 2000).
- [12] A. V. Aho, J. E. Hopcroft, and J. D. Ullman, The Design and Analysis of Computer Algorithms, (Addison-Wesley, Reading (MA) 1974).
- [13] R. Sedgewick, Algorithms in C, (Addison-Wesley, Reading (MA) 1990).
- [14] T. H. Cormen, S. Clifford, C. E. Leiserson, and R. L. Rivest, Introduction to Algorithms, (MIT Press, Cambridge (USA) 2001).
- [15] P. Erdős and A. Rényi, Magyar Tud. Akad. Mat. Kutat Int. Kőzl. 5, 17 (1960).
- [16] B. Bollobás, Random Graphs, (Academic Press, New York 1985).
- [17] D. Stauffer and A. Aharony, Introduction to Percolation Theory, (Taylor & Francis, London 1994).
- [18] B. Pittel, J. Spencer, and N. C. Wormald, J. Comb. Theory B 67, 111 (1996).
- [19] N. C. Wormald, Ann. Appl. Prob. 5, 1217 (1995).