Download - Lecture 2 Graph Theory
-
8/13/2019 Lecture 2 Graph Theory
1/119
Dynamics of Complex Networks and SystemsSYSM 6302 Spring 2014
Mark W. Spong
Lars Magnus Ericsson Chair and DeanThe Erik Jonsson School of Engineering and Computer ScienceThe University of Texas at Dallas
800 W. Campbell Rd.Richardson, TX 75080
Mark W. Spong Dynamics of Complex Networks and Systems
http://find/http://goback/
-
8/13/2019 Lecture 2 Graph Theory
2/119
Graph TheoryA Little History
The history of complex networks has its origins with Leonard Euler’sfamous solution to the Seven Bridges of Königsberg Problem.
River Bank
Island
Island
River BankCan you start at one of the river banks or one of the islands and crosseach bridge once and only once?
Mark W. Spong Dynamics of Complex Networks and Systems
http://find/
-
8/13/2019 Lecture 2 Graph Theory
3/119
Graph TheorySeven Bridges of Koenigsberg
Euler’s solution starts by representing each land mass as a single point(node) and drawing links between these nodes - each link representing a
path over a bridge connecting the two land masses.A
B
C
D
We now call this object a Graph. The number of links at each node iscalled it’s Degree. Euler proved that a solution is possible if and only if one of the following conditions is true:
The degree of each node is even, or
Exactly two of the nodes have odd degreeMark W. Spong Dynamics of Complex Networks and Systems
http://find/
-
8/13/2019 Lecture 2 Graph Theory
4/119
Graph TheorySeven Bridges of Königsberg
Let’s discuss why this is true . . .
Thus we can see that there is no solution to the Seven Bridges of Königsberg Problem.
A
B
C
D
since all four nodes have odd degree, i.e. an odd number of links.
Mark W. Spong Dynamics of Complex Networks and Systems
http://find/
-
8/13/2019 Lecture 2 Graph Theory
5/119
Graph TheorySeven Bridges of Königsberg
As a side note, according to Wikipedia, two of the seven original bridgeswere destroyed during the bombing of Königsberg in World War II. Two
others were later demolished and replaced by a modern highway. Thethree other bridges remain, although only two of them are from Euler’stime (one was rebuilt in 1935). After World War II, the city was renamedKaliningrad. Thus, as of 2000, there are now five bridges in Kaliningrad.
It turns out that exactly two of the nodes have degree 3. The other twohave degree 2. Thus the problem now has a solution provided one beginson one island and ends on the other island.
River Bank
Island
Island
River BankMark W. Spong Dynamics of Complex Networks and Systems
http://find/
-
8/13/2019 Lecture 2 Graph Theory
6/119
Graph TheoryBasic Concepts and Definitions
A mathematical definition of a graph can be stated as follows,
Definition (Graph)
A Graph G (more specifically, an undirected graph) is a finite setV , together with a symmetric relation E on V .
Note: by a Relation E on V is meant a subset of the Cartesianproduct V × V .
The set V = {v1, v2, . . . , vn} is called the Vertex Set of G.
The set E = {{(v1, v2)}, . . . {(vi, vj)} . . . } is called the Edge Set.
RemarkFor simplicity, we write the edge {(vi, vj), (vj , vi)} as vi, vj.We can also label the edges as E = {e1, . . . , em}
Mark W. Spong Dynamics of Complex Networks and Systems
http://find/
-
8/13/2019 Lecture 2 Graph Theory
7/119
Graph TheoryBasic Concepts and Definitions
Example
Consider the graph shown below. The Vertex Set is {v1, v2, v3, v4}.The Edge Set is {e1, e2, e3, e4, e5} = {v1, v2, v2, v3, v1, v3, v3, v4, v2, v4}
v1 v2
v3
v4
e1
e3 e2
e5
e4
Mark W. Spong Dynamics of Complex Networks and Systems
http://find/
-
8/13/2019 Lecture 2 Graph Theory
8/119
Graph TheoryBasic Concepts and Definitions
A graph may have multiple edges connecting the same vertices and may
also have Loops, which are edges connecting a vertex to itself. Such agraph is often called a Multigraph.
v1 v2
v3 v4
Illustrating a Multigraph
A graph without multiple edges between the same pair of vertices andwithout any loops is called a Simple Graph.
Mark W. Spong Dynamics of Complex Networks and Systems
G
http://find/http://goback/
-
8/13/2019 Lecture 2 Graph Theory
9/119
Graph TheoryBasic Concepts and Definitions
Definition
The number of vertices in a graph G, denoted |V |, is called the
Order of G.
The number of edges in a graph G, denoted |E |, is called the Sizeof G.
For example, in the graph below, the Order |V | = 4 and the Size
|E | = 5.
v1 v2
v3
v4
e1
e3 e2
e5
e4
Mark W. Spong Dynamics of Complex Networks and Systems
G h Th
http://find/
-
8/13/2019 Lecture 2 Graph Theory
10/119
Graph TheoryBasic Concepts and Definitions
Definition
Two vertices are said to be Adjacent if vi, vj ∈ E (G). Otherwise
vi, vj are Nonadjacent.If e = vi, vj ∈ E (G) then vi and vj are Incident to or with theedge e.
If u, v and u, w are distinct edges of G, then u, v and u, ware called Adjacent Edges.
For example, in the graph below, v1 and v2 are adjacent vertices, whilev1 and v4 are nonadjacent. Also, v1, v2 and v1, v3 are adjacent edges,whereas the edges v1, v2 and v3, v4 are nonadjacent.
v1 v2
v3
v4
e1
e3 e2
e5
e4
Mark W. Spong Dynamics of Complex Networks and Systems
G h Th
http://find/
-
8/13/2019 Lecture 2 Graph Theory
11/119
Graph TheoryBasic Concepts and Definitions
Definition (Digraph)
A Directed Graph, or Digraph, is a finite set V together with a
relation E on V , not necessarily symmetric.
Each ordered pair (u, v) ∈ E (G) is called a Directed Edge or Arc.Digraphs are drawn with arrows to indicate the directed edges.
Example
Consider the directed graph below. The arrows indicate that the edges v1, v2 and v2, v3 belong to the edge set E (G) but v2, v1 and v3, v2 are not in E (G).
v1 v2
v3
Mark W. Spong Dynamics of Complex Networks and Systems
G h Th
http://find/
-
8/13/2019 Lecture 2 Graph Theory
12/119
Graph TheoryBasic Concepts and Definitions
Example
Digraphs are used when information flow or relationships are one-way, i.e.non-symmetric.
Parent
Child Child
Grandchild
Mark W. Spong Dynamics of Complex Networks and Systems
G h Th
http://find/
-
8/13/2019 Lecture 2 Graph Theory
13/119
Graph TheoryBasic Concepts and Definitions
ExampleA graph is also a digraph. The diagrams below are all equivalent ways to represent the same information. Graph (a) is drawn as an undirected graph, graph (b) is drawn as a multigraph, and graph (c) is drawn as adirected graph.
v1
v2
v3
v4
(a)
v1
v2
v3
v4
(b)
v1
v2
v3
v4
(c)
Mark W. Spong Dynamics of Complex Networks and Systems
G h Th
http://find/
-
8/13/2019 Lecture 2 Graph Theory
14/119
Graph TheoryBasic Concepts and Definitions
Example
A city has both two-way and one-way streets. The traffic pattern may be represented as a digraph where intersections are vertices and an arc u, vmeans that it is possible to drive legally from u to v.
v1 v2 v3 v4
v5v6v7
Mark W. Spong Dynamics of Complex Networks and Systems
Graph Theory
http://find/
-
8/13/2019 Lecture 2 Graph Theory
15/119
Graph TheoryWeighted Graphs and Networks
In many applications it is useful to assign values or weights to the edgesof a graph.
Definition (Weighted Graph)
A Weighted Graph is a graph together with a function f : E → . The
function f assigns a real number (a weight) to each edge of the graph.
Remark
A weighted graph is also called a Network. Since, given any graph, we can trivially assign a weight of unity to each edge, we use the terms graph and network interchangeably.
Mark W. Spong Dynamics of Complex Networks and Systems
Graph Theory
http://find/
-
8/13/2019 Lecture 2 Graph Theory
16/119
Graph TheoryBasic Concepts and Definitions
Example
Cities v1, . . . , v4 are connected by multiple highways. The weights represent average travel times in hours.
v1
v2
v3
v4
1
3
1
4
5
6
6
8
Mark W. Spong Dynamics of Complex Networks and Systems
Graph Theory
http://find/
-
8/13/2019 Lecture 2 Graph Theory
17/119
Graph TheoryFurther Definitions
Definition
By a ( p, g)-graph we mean a graph of order p and size g. Let v ∈ G be avertex if G. The number of edges incident with v is called the Degree of v in G, denoted deg v.
Example
v1 v2
v3 v4
v5
The degrees of the vertices v1, v2, v3, v4, v5 are, respectively 1, 2, 3, 2, 0.
Mark W. Spong Dynamics of Complex Networks and Systems
Graph Theory
http://find/
-
8/13/2019 Lecture 2 Graph Theory
18/119
Graph TheoryFurther Properties
In an undirected graph G each edge contributes to the degree sum of thetwo vertices to which it is connected. Hence the following theorem isimmediate:
Theorem
For an undirected graph G the sum of the degrees of the vertices is twice the number of edges.
Example
The graph in the previous example is seen to have four edges, and the
sum of the degrees of the vertices is 1 + 2 + 3 + 2 + 0 = 8.
Mark W. Spong Dynamics of Complex Networks and Systems
Graph Theory
http://find/http://goback/
-
8/13/2019 Lecture 2 Graph Theory
19/119
Graph TheoryFurther Properties
As a Corollary to the previous theorem, we can state
Corollary
Every undirected graph contains an even number of odd vertices.
Proof: Let ne be the total number of edges in a graph and let de and dobe the sum of the degrees of the even and odd vertices, respectively.From the previous theorem we have do = 2 ∗ ne − de. Thus, do is aneven number. Since do is calculated as a sum of odd numbers (thedegrees of odd vertices), it must be the sum of an even number of terms.
CorollaryThe number of people on this planet who have shaken hands withan odd number of people is even.
Mark W. Spong Dynamics of Complex Networks and Systems
Complex Networks
http://find/
-
8/13/2019 Lecture 2 Graph Theory
20/119
Complex NetworksIn-Degree, Out-Degree
The previous results on vertex degree hold only for undirected graphs, in
general. For a Directed Graph we have the following:
Definition
Let G be a directed graph. The In-Degree of a vertex v ∈ G is thenumber of edges Entering v
The Out-Degree of a vertex v ∈ G is the number of edges Leaving v.The Degree of v is then the sum In-Degree + Out-Degree.
v
For example, the In-Degree of the above node v is one and theOut-Degree is two.
Mark W. Spong Dynamics of Complex Networks and Systems
Graph Theory
http://goforward/http://find/http://goback/
-
8/13/2019 Lecture 2 Graph Theory
21/119
Graph TheoryBasic Concepts and Definitions
Definition
If every vertex of a graph G has the same degree r, we say that thegraph is r-Regular.
The graph G below is a 3-regular graph.
v1
v2v3
v4
v5 v6
Mark W. Spong Dynamics of Complex Networks and Systems
Graph Theory
http://find/
-
8/13/2019 Lecture 2 Graph Theory
22/119
Graph TheoryBasic Concepts and Definitions
DefinitionA graph is Complete if every two vertices are adjacent.
The complete graph with p vertices is typically denoted as K p. Thefigure below shows the first five complete graphs.
v1
K 1
v1
v2
K 2
v1
v2 v3
K 3
v1v2
v3 v4
K 4
v1
v2
v3
v4 v4K 5
Mark W. Spong Dynamics of Complex Networks and Systems
Graph Theory
http://find/
-
8/13/2019 Lecture 2 Graph Theory
23/119
Graph TheoryFurther Properties
The complete graph K 6 is shown below:
v1
v2v3
v4
v5 v6
Theorem
A complete graph of order p is ( p − 1)-regular.The complete graph K n has
n(n−1)2 edges
Mark W. Spong Dynamics of Complex Networks and Systems
Graph Theory
http://find/
-
8/13/2019 Lecture 2 Graph Theory
24/119
p yThe Hakimi-Havel Theorem
The Degree Sequence of a graph is a list of the vertex degrees in
descending order.
Example
v1
v2
v3
v4
The degree sequence of the above graph is therefore [3, 3, 2, 2].
Mark W. Spong Dynamics of Complex Networks and Systems
Graph Theory
http://find/
-
8/13/2019 Lecture 2 Graph Theory
25/119
p yGraphical Sequences
An interesting question is whether a given sequence of integers indescending order corresponds to a physical graph.
Such a sequence is called Graphical.
ExampleCan you draw a graph with degree sequence [3, 2, 2, 2]? What about the degree sequence [3, 2, 1]?
The following Theorem gives a constructive procedure to determine
whether or not a give sequence is graphical.
Mark W. Spong Dynamics of Complex Networks and Systems
Graph Theory
http://find/
-
8/13/2019 Lecture 2 Graph Theory
26/119
p yGraphical Sequences
Theorem (Hakimi-Havel)
Let ν = [v1, v2, . . . , vk] be a non-increasing sequence of k ≥ 2 integers such that no component vi of ν is greater than k − 1. Let ν̃ be the
vector obtained from ν by deleting v1 from ν and subtracting 1 fromeach of the next v1 components of ν . Let ν 1 be the non-increasing vector obtained from ν by rearranging components, if necessary.Then ν is graphical if and only if ν 1 is graphical.
Mark W. Spong Dynamics of Complex Networks and Systems
Graph Theory
http://find/
-
8/13/2019 Lecture 2 Graph Theory
27/119
p yHakimi-Havel Theorem
We can therefore use the following algorithm to determine if a givensequence of integers is graphical.
Step 0: Set ν as the current vector with k components
Step 1: If any component of ν is greater than k − 1 go to Step 5
Step 2: If any component of ν is negative go to Step 5
Step 3: If all components of ν are equal to 0, go to Step 6
Step 4: Rearrange ν so that it becomes a non-increasing sequence of integers with v1 as first component. Delete v1 and subtract 1 from eachof the next v1 components of ν . Go to Step 1.
Step 5: ν is not graphical. Go to Step 7.
Step 6: ν is graphical. Go to Step 7.
Step 7: Stop
Mark W. Spong Dynamics of Complex Networks and Systems
Graph Theory
http://find/
-
8/13/2019 Lecture 2 Graph Theory
28/119
Hakimi-Havel Theorem
Example
Let ν = [5, 4, 4, 3, 3, 3, 2]. Then the above algorithm gives
Iteration 1: ν 1 = [3, 3, 2, 2, 2, 2]
Iteration 2: ν̃ = [2, 1, 1, 2, 2]; ν
1
= [2, 2, 2, 1, 1]Iteration 3: ν 1 = [1, 1, 1, 1]
Iteration 4: ν̃ = [0, 1, 1]; ν 1 = [1, 1, 0]
Iteration 5: ν 1 = [0, 0]
Therefore, ν is graphical.
Mark W. Spong Dynamics of Complex Networks and Systems
Graph Theory
http://find/
-
8/13/2019 Lecture 2 Graph Theory
29/119
Hakimi-Havel Theorem
The graph below has the given degree sequence ν = [5, 4, 4, 3, 3, 3, 2].
v1
v2v3
v4
v5 v6
v7
Mark W. Spong Dynamics of Complex Networks and Systems
Graph TheoryG h I hi
http://find/
-
8/13/2019 Lecture 2 Graph Theory
30/119
Graph Isomorphism
How can we tell when two given graphs represent the ‘same’ structure?Intuitively, two graphs are identical if it is possible to relabel and redrawone to appear identical to the other.
Example
In the figure below, it is easy to see that graphs G1 and G2 are the same,
but that G3 is fundamentally different.
v1 v2
v3 v4
(G1)
u1 u2
u3
u4
(G2)
u1 u2
u3
u4
(G3)
Mark W. Spong Dynamics of Complex Networks and Systems
Graph TheoryG h I hi
http://find/
-
8/13/2019 Lecture 2 Graph Theory
31/119
Graph Isomorphism
Definition
Let G1 and G2 be graphs. An Isomorphism from G1 to G2 is aone-to-one mapping
φ : V (G1) → V (G2)
onto V (G2) such that two vertices u1, v1 are adjacent in G1 if and onlyif vertices φ(u1), φ(v1) are adjacent in G2.
We say that G1 and G2 are Isomorphic Graphs if there exists anisomorphism between them.
If φ : V (G1) → V (G2) is an isomorphism, then the Inverse mapping φ−1
exists and is an isomorphism from G2 to G1. φ−1 is defined as follows:
φ−1(v2) = v1 ∈ G1 such that φ(v1) = v2.
Mark W. Spong Dynamics of Complex Networks and Systems
Graph TheoryG h Is his
http://find/
-
8/13/2019 Lecture 2 Graph Theory
32/119
Graph Isomorphism
The isomorphism relation is an Equivalence Relation on the set of graphs. This means that isomorphism relation partitions the set of allgraphs into Equivalence Classes.
Remark
It is easy to see that if G1 and G2 are isomorphic graphs then they have the same order and same size. Also, the degrees of the vertices are the same.
However, if two graphs have the same order and size and the vertices have the same degrees, they are not necessarily isomorphic.
Mark W. Spong Dynamics of Complex Networks and Systems
Graph TheoryGraph Isomorphism
http://find/
-
8/13/2019 Lecture 2 Graph Theory
33/119
Graph Isomorphism
Example
The graphs G1 and G2 shown below each have order 6 and size 9.Moreover, the degree of each vertex is the same in each graph. Yet the two graphs are not isomorphic. (How can we prove this?)
v1
v2
v3
v4
v5
v6
u1 u2
u3u4
v5
v6
Mark W. Spong Dynamics of Complex Networks and Systems
Graph TheoryConnectivity
http://find/
-
8/13/2019 Lecture 2 Graph Theory
34/119
Connectivity
Connectivity is one of the most important properties of a network.Intuitively, a graph is connected if it is possible to travel between any two
vertices along edges of the graph.Example
The graph on the left is connected. It is possible to start at any vertex of the graph and reach any other vertex by following edges of the graph.The graph on the right is clearly not connected since node v1 is not
connected by an edge to any other node in the graph.
v1
v2
v3
v4
v1
v2
v3
v4
Mark W. Spong Dynamics of Complex Networks and Systems
Graph TheoryConnectedness
http://find/
-
8/13/2019 Lecture 2 Graph Theory
35/119
Connectedness
We next give a few definitions and terminology related to traveling on
networks, i.e. moving between nodes along incident edges.Definition
A uv walk is a sequence of vertices and edges beginning with u andending with v.
A closed walk is a walk with u = v.
A trail is a walk in which all edges are distinct.
A circuit is trail in which u = v.
A path is a trail in which all vertices are distinct.
A Cycle is a circuit that does not repeat any vertices, except the
first and the last.
We will illustrate these concepts using the 3-regular graph with 6 nodes.
Mark W. Spong Dynamics of Complex Networks and Systems
Graph TheoryConnectedness
http://find/
-
8/13/2019 Lecture 2 Graph Theory
36/119
Connectedness
Example
Shown below is a v1v4 walk: {v1, v2, v2, v5, v5, v4}
Since all edges in this walk are distinct, it is also a Trail.
v1
v2v3
v4
v5 v6
Mark W. Spong Dynamics of Complex Networks and Systems
Graph TheoryConnectedness
http://find/
-
8/13/2019 Lecture 2 Graph Theory
37/119
Connectedness
Example
Shown below is a v1v1 closed-walk: {v1, v2, v2, v5, v5, v4, v4, v1}
Since this is also a Trail, it is also a Circuit. Since no vertices are repeated, except the first and last, it is also a Cycle.
v1
v2v3
v4
v5 v6
Mark W. Spong Dynamics of Complex Networks and Systems
Graph TheoryConnectedness
http://find/
-
8/13/2019 Lecture 2 Graph Theory
38/119
Example
Shown below is a Path from v3 to v6.
v1
v2v3
v4
v5 v6
Mark W. Spong Dynamics of Complex Networks and Systems
Graph TheoryConnectedness
http://find/
-
8/13/2019 Lecture 2 Graph Theory
39/119
There are generally many paths between given nodes. Often, we areinterested in finding the shortest path between two nodes. In this case,
the shortest path from v3 to v6 is
v1
v2v3
v4
v5 v6
Mark W. Spong Dynamics of Complex Networks and Systems
Graph TheoryConnectedness
http://find/
-
8/13/2019 Lecture 2 Graph Theory
40/119
The figure below summarizes the relationships among the various notionsof
Walk
Trail
Circuit
Cycle
Path
Mark W. Spong Dynamics of Complex Networks and Systems
Graph TheoryConnectedness
http://find/
-
8/13/2019 Lecture 2 Graph Theory
41/119
Finally, we can state the following
Definition
Two vertices are Connected if there is a uv path connecting them.
A graph is Connected if every two vertices are connected; otherwise
it is disconnected.
This matches our intuitive notion of what it means for a graph to beconnected.
Mark W. Spong Dynamics of Complex Networks and Systems
Graph TheorySubgraphs
http://find/http://goback/
-
8/13/2019 Lecture 2 Graph Theory
42/119
Definition
Let G be a graph. A graph H is a Subgraph of G if V (H ) ∈ V (G) and
E (H ) ∈ E (G).If a graph F is isomorphic to a subgraph H of G, then F is also called asubgraph of G.
Example
v1
v2
v3
v4
v5 v6
v2
v3
v4
v5 v6
Mark W. Spong Dynamics of Complex Networks and Systems
Graph TheoryComponents of a Graph
http://goforward/http://find/http://goback/
-
8/13/2019 Lecture 2 Graph Theory
43/119
DefinitionA connected subgraph H of a graph G is a Component of G if H is notcontained in any connected subgraph of G having more vertices or edgesthan H .
Mark W. Spong Dynamics of Complex Networks and Systems
Graph TheoryComponents of a Graph
http://find/
-
8/13/2019 Lecture 2 Graph Theory
44/119
Example
The graph below represented by the orange vertices and bold edges is not a component. Adding any of the vertices and edges connected to them results in a larger connected subgraph of the total graph.
Remark
A connected graph has only one component.
Mark W. Spong Dynamics of Complex Networks and Systems
Graph TheoryCut-Vertices and Bridges
http://find/
-
8/13/2019 Lecture 2 Graph Theory
45/119
It is often important to know if a connected graph remains connected if a
given vertex or edge is removed.
Example
v1
v2
v3
v4 v5
v6
v7
v8
We see that removing the edge v4, v5 disconnects the graph. Removing any edge other than v4, v5 leaves the graph connected.
Mark W. Spong Dynamics of Complex Networks and Systems
Graph TheorySubgraphs
http://find/
-
8/13/2019 Lecture 2 Graph Theory
46/119
Definition
If e is an edge of a graph G then G − e is the subgraph of G havingthe same vertex set and all edges of G except e.
If v is a vertex of G then G − v is the subgraph of G whose vertexset consists of all vertices of G except v and all edges of G except
those edges that are incident with v.An edge e is a Bridge if G − e is disconnected.
A vertex v is a Cut-Vertex if G − v is disconnected.
Theorem
Let G be a connected graph. An edge e of G is a bridge if and only if edoes not lie on any cycles of G.
Mark W. Spong Dynamics of Complex Networks and Systems
Graph TheoryBridges
http://find/
-
8/13/2019 Lecture 2 Graph Theory
47/119
Consider again the graph below.
v1
v2
v3
v4 v5
v6
v7
v8
We see that only edge v4, v5 does not lie on any cycle.
Any edge other than v4, v5 can be removed without affectingconnectivity of the graph.
Mark W. Spong Dynamics of Complex Networks and Systems
Graph TheoryStrongly and Weakly Connected Digraphs
http://find/
-
8/13/2019 Lecture 2 Graph Theory
48/119
Fora directed graph the notion of connectivity is different from that of an
undirected graph. In a digraph, two vertices vi and vj may be connectedby edges but there may not necessarily be a directed path from vi to vj .
We would like to distinguish such a situation from one where there is noedge at all connecting vi and vj . We do this by introducing the notionsof Strong and Weak connectivity.
v1
v2
v3
v4
v1
v2
v3
v4
Mark W. Spong Dynamics of Complex Networks and Systems
Graph TheoryStrongly and Weakly Connected Digraphs
http://find/
-
8/13/2019 Lecture 2 Graph Theory
49/119
DefinitionA directed graph is Strongly Connected if there is a directed pathbetween any two vertices. The Strong Components are themaximal strongly connected subgraphs.
A directed graph is Weakly Connected if there is an undirected
path connecting any two vertices.
In other words, strongly connected means that one can find a pathbetween vertices respecting the direction of the arrows.
Weakly connected means that on can find a path possibly ignoring thesense of the arrows, when necessary.
Mark W. Spong Dynamics of Complex Networks and Systems
Graph TheoryStrongly and Weakly Connected Digraphs
http://find/
-
8/13/2019 Lecture 2 Graph Theory
50/119
The figure below illustrates the differences between weak connectivityand strong connectivity for directed graphs.
v1
v2
v3
v4
Strongly Connected
v1
v2
v3
v4
Weakly Connected
Mark W. Spong Dynamics of Complex Networks and Systems
Eulerian and Hamiltonian Graphs
http://find/
-
8/13/2019 Lecture 2 Graph Theory
51/119
In this lecture we will discuss Eulerian and Hamiltonian graphs.
Eulerian and Hamiltonian graphs arise in transportation problems in
operations research, in bioinformatics, in computer programmingapplications, and other applications.
Definition
(Traversable and Eulerian Graphs)
A graph (or multigraph) G is called Traversable if there is a trailcontaining all vertices and edges of G. Such a trail is called anEulerian Trail.
A circuit in a graph containing all vertices and edges is called anEulerian Circuit. (Recall that a circuit is a trail beginning and
ending at the same vertex).In this case the graph G is called an Eulerian Graph.
Mark W. Spong Dynamics of Complex Networks and Systems
Eulerian and Hamiltonian GraphsEulerian Graphs
http://find/
-
8/13/2019 Lecture 2 Graph Theory
52/119
We have already discussed the concept of Eulerian Trails and Circuits inour introduction to the Seven Bridges of Königsberg Problem. We cansummarize this as the following
Theorem
Let G be a connected graph.
G is Eulerian if and only if the degree of every vertex is even.
G is Traversable if and only if there are exactly zero or two vertices of G with odd degree.
A method for finding an Eulerian trail, when one exists, was given by theFrench mathematician M. Fleury in 1883.
Mark W. Spong Dynamics of Complex Networks and Systems
Eulerian and Hamiltonian GraphsFleury’s Algorithm
http://find/
-
8/13/2019 Lecture 2 Graph Theory
53/119
Given a traversable graph, G, Fleury’s Algorithm is relatively simple andscales linearly in the number of edges. We can state Fleury’s Algorithmas follows:
If G has exactly two odd vertices, pick one of them. Otherwise, pickany vertex, V , to start.
From V , choose any edge, e, that is not a bridge unless there is noother edge available.
Traverse the chosen edge to the next vertex.
Remove (or otherwise label) the edge, e, forming the reduced graphG
−e.
Repeat the above procedure until all edges have been traversed.
Mark W. Spong Dynamics of Complex Networks and Systems
Eulerian and Hamiltonian GraphsFleury’s Algorithm
http://find/
-
8/13/2019 Lecture 2 Graph Theory
54/119
The key point to remember is not to traverse bridge edges if other edgesare available.
Exercise
Apply Fleury’s Algorithm to the graph G below.
v1
v2
v3
v4 v5
v6
v7
v8
Mark W. Spong Dynamics of Complex Networks and Systems
Eulerian and Hamiltonian GraphsApplications
http://find/
-
8/13/2019 Lecture 2 Graph Theory
55/119
An interesting application of Eulerian Graphs is for the problem of
reconstructing DNA sequences from fragments of DNA.Pevzner, Pavel A.; Tang, Haixu; Waterman, Michael S. (2001). ”An Eulerian
trail approach to DNA fragment assembly”. Proceedings of the National
Academy of Sciences of the United States of America 98 (17)
Other applications include
Routing of garbage trucks or postal trucks
Checking a website for broken links
Mazes and Labrynths
Designing fault tolerant computer networksAll of these applications involve navigating through a graph while ideallynavigating each edge at most once.
Mark W. Spong Dynamics of Complex Networks and Systems
Eulerian and Hamiltonian GraphsHierholzer’s Algorithm
http://find/
-
8/13/2019 Lecture 2 Graph Theory
56/119
Although Fleury’s algorithm is linear in the number of edges, one mustalso factor in the problem of determining bridge edges, which increases
the computational complexity, roughly from O(|E |
) to O
(|E |
2).
In the case of Eulerian graphs, a more efficient, O(|E |), algorithm isHierholzer’s Algorithm.
Choose any starting vertex V and follow a trail of edges that returnsto V forming a circuit. Since the degree of each vertex is even, sucha circuit will always exist because, when the trail enters anothervertex U there must be an unused edge leaving U .
If all edges belong to the circuit above, it is an Eulerian circuit. If not, choose a vertex, W , belonging to the circuit that has adjacentedges not on the circuit.
Follow a new trail from W following unused edges of the graph untilreturning to W .
Join the circuit starting from W to the existing circuit.Continue in this way until all edges are used.
Mark W. Spong Dynamics of Complex Networks and Systems
Eulerian and Hamiltonian GraphsExample
http://find/
-
8/13/2019 Lecture 2 Graph Theory
57/119
Consider the Eulerian graph below
A B
C D
E F
Since the degree of every node is even, we can choose the starting nodearbitrarily. Starting, for example, from F we can follow the circuit
FCDF . Next, if we choose D, we can follow the circuit DABD.Joining this circuit to the previous one gives F CDABDF .
Next, if we choose A, we have the circuit AECA. Finally, joining this tothe previous cycle gives the Eulerian Cycle FCDAECABDF .
Mark W. Spong Dynamics of Complex Networks and Systems
Eulerian and Hamiltonian GraphsHamiltonian Graphs
D fi i i
http://find/
-
8/13/2019 Lecture 2 Graph Theory
58/119
Definition
A graph G is Hamiltonian if there is a cycle containing every vertex of
G.Finding Hamiltonian paths, or even knowing when one exists is a muchharder problem and there are no easy solutions known.
Example
The graph G1 below is Hamiltonian, while G2 is not. In G1 it is easy to see that u1, u2, u5, u4, u3, u1 is a Hamiltonian cycle.
Mark W. Spong Dynamics of Complex Networks and Systems
Eulerian and Hamiltonian GraphsHamiltonian Graphs
http://find/
-
8/13/2019 Lecture 2 Graph Theory
59/119
Remark
The graph G2 is not Hamiltonian.
Proof: The proof is by contradiction. Suppose that G2 is Hamiltonian.The G2 contains a Hamiltonian cycle C containing every vertex of G2. Inparticular, C contains v2, v3 and v4. Each of these vertices has degreetwo. Therefore the cycle C must contain both edges incident with eachof these vertices. In particular, C must contain the edges v1v2, v1v3 andv1v4. However, any cycle can contain only two edges incident with avertex on the cycle. Therefore, G2 is not Hamiltonian.
Mark W. Spong Dynamics of Complex Networks and Systems
Eulerian and Hamiltonian GraphsHamiltonian Graphs
http://find/
-
8/13/2019 Lecture 2 Graph Theory
60/119
Theorem
If G is a graph of order p ≥ 3 such that deg v ≥ p/2 for every vertex G,
then G is Hamiltonian.
Proof: If G has order p = 3 and deg v ≥ 3/2 for every vertex of G thenG is a triangle. Therefore the result is true for p = 3. Suppose now that
p ≥ 4. Among all paths in G, let P be a path with the largest number of
vertices. Suppose P : u1, u2, . . . , uk is this path as shown in the figurebelow.
Mark W. Spong Dynamics of Complex Networks and Systems
Eulerian and Hamiltonian GraphsHamiltonian Graphs
Since no path in G has more vertices than P every vertex adjacent to u1
http://find/
-
8/13/2019 Lecture 2 Graph Theory
61/119
Since no path in G has more vertices than P , every vertex adjacent to u1and to uk must belong to P . Since u1 is adjacent to at least p/2vertices, it follows that P must contain at least 1 + p/2 vertices.
Now, there must be some vertex ui on P , with 2 ≤ i ≤ k, such that u1 isadjacent to ui and uk is adjacent to ui−1. If this were not the case, thenfor each vertex ui adjacent to u1, the vertex ui−1 would not be adjacentto uk. However, since there are at least p/2 vertices ui adjacent to u1,there would be at least p/2 vertices ui−1 not adjacent to uk. Thereforedeg uk ≤ ( p − 1) − p/2 < p/2, which is impossible since deg uk ≥ p/2.Hence there is a vertex ui on P such that u1ui and ukui−1 are bothedges of G.
Mark W. Spong Dynamics of Complex Networks and Systems
Eulerian and Hamiltonian GraphsHamiltonian Graphs
It follows that there is a cycle C containing all the vertices of P as shown
http://find/
-
8/13/2019 Lecture 2 Graph Theory
62/119
It follows that there is a cycle C containing all the vertices of P as shownin the figure below.
If all vertices of G belong to C , then C is a Hamiltonian cycle and G is aHamiltonian graph. Suppose there is a vertex w of G that does not
belong to C . Since C contains at least 1 + p/2 vertices, fewer than p/2vertices of G do not lie on C . Since deg w ≥ p/2, the vertex w must beadjacent to some vertex uj of C . However, the edge wuj and the cycleC together produce a path having one more vertex than P , whichcontradicts the fact that P is maximal. Therefore C must contain all thevertices of G so that G is Hamiltonian.
Mark W. Spong Dynamics of Complex Networks and Systems
Eulerian and Hamiltonian GraphsHamiltonian Graphs
http://find/
-
8/13/2019 Lecture 2 Graph Theory
63/119
Remark The condition deg v ≥ p/2 for every vertex v of a graph G issufficient for G to be Hamiltonian, it is not necessary. For example, Gmay just be a cycle, hence Hamiltonian, in which case every vertex hasdegree two independent of the number of vertices.
Mark W. Spong Dynamics of Complex Networks and Systems
Eulerian and Hamiltonian GraphsSome Necessary Conditions
http://find/
-
8/13/2019 Lecture 2 Graph Theory
64/119
The conditions below are Necessary for a graph to be Hamiltonian. Inother words, if a graph is Hamiltonian, then the conditions are true.
1 Every undirected Hamiltonian graph is connected and every directed
Hamiltonian graph is strongly connected.2 Every vertex of a Hamiltonian graph has degree ≥ 2.
3 If v is a node in an undirected Hamiltonian graph G and deg(v) = 2,both edges incident on v are part of every Hamiltonian cycle of G.
Mark W. Spong Dynamics of Complex Networks and Systems
Eulerian and Hamiltonian GraphsSome Sufficient Conditions
http://find/
-
8/13/2019 Lecture 2 Graph Theory
65/119
The conditions below are Sufficient for a graph to be Hamiltonian. Inother words, if the conditions are true, then the graph is Hamiltonian.
1 Every complete, undirected graph is Hamiltonian.
2 If G is a simple graph of order n such that deg(u) + deg(v) > n − 1
for every pair of vertices u and v, then G is Hamiltonian.3 If G is a simple graph of order n such that the degree of each vertex
is at least n/2, then G is Hamiltonian.
4 If G is a simple graph of order n ≥ 3 and if deg(u) + deg(v) ≥ n forall nodes u and v that are not adjacent, then G is Hamiltonian.
Mark W. Spong Dynamics of Complex Networks and Systems
Eulerian and Hamiltonian GraphsThe Traveling Salesman Problem
The Traveling Salesman Problem deals with finding a Hamiltonian
http://find/
-
8/13/2019 Lecture 2 Graph Theory
66/119
The Traveling Salesman Problem deals with finding a Hamiltoniancycle on a network, i.e. a weighted graph. The weights represent the cost
of traversing the edges.Example
Suppose a Salesman is to visit a number of cities and return home. Theedge weights may represent distance or time. The problem is to find theHamiltonian cycle such that minimizes the total travel distance or travel
time.
Mark W. Spong Dynamics of Complex Networks and Systems
Eulerian and Hamiltonian GraphsFinding Hamiltonian Cycles
The numbers of simple Hamiltonian graphs on n nodes for n = 2 3
http://find/
-
8/13/2019 Lecture 2 Graph Theory
67/119
The numbers of simple Hamiltonian graphs on n nodes for n = 2, 3, . . .are given by 0, 1, 3, 8, 48, 383, 6196, 177083, . . . .
Hamiltonian graphs with three and four nodes
In the theory of computational complexity, the decision version of theTSP (where, given a length L, the task is to decide whether any tour isshorter than L) belongs to the class of NP-complete problems. Thus, itis likely that the worst case running time for any algorithm for the TSPincreases exponentially with the number of cities.
Mark W. Spong Dynamics of Complex Networks and Systems
Eulerian and Hamiltonian GraphsTraveling Salesman Problem
http://find/
-
8/13/2019 Lecture 2 Graph Theory
68/119
The TSP problem was first formulated as a mathematical problem in
1930 and is one of the most intensively studied problems in optimization.It is used as a benchmark for many optimization methods. Even thoughthe problem is computationally difficult, a large number of heuristics andexact methods are known, so that some instances with tens of thousandsof cities can be solved.
The TSP has several applications, such as planning, logistics, and themanufacture of microchips. Slightly modified, it appears as asub-problem in many areas, such as DNA sequencing. In theseapplications, the concept city represents, for example, customers,soldering points, or DNA fragments, and the concept distance represents
traveling times or cost, or a similarity measure between DNA fragments.In many applications, additional constraints such as limited resources ortime windows make the problem considerably harder.
Mark W. Spong Dynamics of Complex Networks and Systems
Eulerian and Hamiltonian GraphsCircuit Board Drilling
A famous application of the TSP is the problem of drilling holes in a
http://find/
-
8/13/2019 Lecture 2 Graph Theory
69/119
circuit board.
Suppose you want to automate the drilling of a number of holes in acircuit board. In order to minimize the time it takes to drill the holes, oneshould minimize the total distance traveled by the drill bit. The figurebelow shows a pattern of 2400 holes and an optimal schedule whose totaldistance is less than half of a brute force ‘raster scan.’
Mark W. Spong Dynamics of Complex Networks and Systems
Graphs and MatricesAdjacency Matrix
D fi i i
http://find/
-
8/13/2019 Lecture 2 Graph Theory
70/119
Definition
(Adjacency Matrix)
Let G be a simple graph of order p with vertices v1, v2, . . . , v p.Then the Adjacency Matrix A = A(G) = (aij) is the p × p matrix withaij = 1 if vertices vi and vj are adjacent and aij = 0 otherwise.
Example
Consider the graph G1 below. The Adjacency matrix A1 is given by v1 v2
v3
v4
G1 A1 =
0 1 1 01 0 1 01 1 0 10 0 1 0
Mark W. Spong Dynamics of Complex Networks and Systems
Graphs and MatricesRemarks
http://find/
-
8/13/2019 Lecture 2 Graph Theory
71/119
Remarks
Since the graph is undirected, the adjacency matrix is symmetric,i.e. aij = aji .
Also, since the graph is simple the diagonal elements of theadjacency matrix are zero and the off-diagonal elements are 0 or 1.
Moreover, the sum of the elements of row i is the degree of vertex i.
The sum of all the elements of the adjacency matrix is equal totwice the numbers of edges in the graph.
Clearly the adjacency matrix depends on how we label the vertices.
The same graph with different labels will generally give rise to adifferent adjacency matrix.
Mark W. Spong Dynamics of Complex Networks and Systems
Graphs and MatricesExample
Example
http://find/
-
8/13/2019 Lecture 2 Graph Theory
72/119
Example
Consider the graph G2 below. The Adjacency matrix A2 is given by
v1
v2
v3v4
G2 A2 =
0 1 0 01 0 1 10 1 0 10 1 1 0
The graphs G1 and G2 are isomorphic. The mapping
φ : (v1, v2, v3, v4) → (v4, v3, v2, v1)
defines an isomorphism between the graphs G1 and G2.
Note that we may also describe the relationship between V (G1) andV (G2) as a permutation on the index set (1, 2, 3, 4) → (4, 3, 2, 1).
Mark W. Spong Dynamics of Complex Networks and Systems
Graphs and MatricesPermutation Matrices
Definition
http://find/
-
8/13/2019 Lecture 2 Graph Theory
73/119
Definition
A Permutation Matrix is a matrix formed from the n × n identity
matrix by permuting the rows.
Example
Suppose π : {1, 2, 3, 4} → {1, 2, 3, 4} is a permutation given by
π(1, 2, 3, 4) = (2, 4, 1, 3)
Then the permutation matrix P π associated with the permutation π is
P π =
0 1 0 00 0 0 1
1 0 0 00 0 1 0
We note that permutation matrices are Orthogonal, i.e. P −1 = P T .
Mark W. Spong Dynamics of Complex Networks and Systems
Graphs and MatricesPermutation Matrices
Th
http://find/
-
8/13/2019 Lecture 2 Graph Theory
74/119
Theorem
Suppose two graphs G1 and G2 with adjacency matrices A1 and A2 are
given. Then G1 and G2 are isomorphic graphs if and only if there exists apermutation matrix P such that
P A1P T = A2
Back to the previous example, one can show that (1, 2, 3, 4) → (4, 3, 2, 1)is the permutation of vertex indices relating graphs G1 and G2. Formingthe associated permutation matrix P it is an easy calculation to showthat
0 0 0 1
0 0 1 00 1 0 01 0 0 0
0 1 1 0
1 0 1 01 1 0 10 0 1 0
0 0 0 1
0 0 1 00 1 0 01 0 0 0
=
0 1 0 0
1 0 1 10 1 0 10 1 1 0
Mark W. Spong Dynamics of Complex Networks and Systems
Graphs and MatricesFurther Matrix Properties
An interesting property of the adjacency matrix is the following:
http://find/
-
8/13/2019 Lecture 2 Graph Theory
75/119
Theorem
Let A be the adjacency matrix of a graph G withV (G) = {v1, v2, . . . , v p). Then the (i, j) entry of A
n gives the number of different vivj walks of length n in G.
Example
Consider again the graph G1 and adjacency matrix below v1 v2
v3
v4
G1 A1
=
0 1 1 01 0 1 0
1 1 0 10 0 1 0
Mark W. Spong Dynamics of Complex Networks and Systems
Graphs and MatricesFurther Matrix Properties
3
http://goforward/http://find/http://goback/
-
8/13/2019 Lecture 2 Graph Theory
76/119
Then a simple calculation shows that A31 is given by
A31 =
2 3 4 13 2 4 14 4 2 31 1 3 0
Thus, for example, there are three walks of length three between thevertices v1 and v2.
v1 v2
v3
v4
G1
Mark W. Spong Dynamics of Complex Networks and Systems
Graphs and MatricesAdjacency Matrix of a Digraph
http://goforward/http://find/http://goback/
-
8/13/2019 Lecture 2 Graph Theory
77/119
If the graph G is directed, i.e. a digraph we define the (i, j) entry of theadjacency matrix to be 1 if and only if there is an arc from vertex i tovertex j.
In this case the adjacency matrix is not necessarily symmetric.
The sum of the entries of any row of the adjacency matrix is the
outdegree of the vertex. The sum of the entries of any column is theindegree of the corresponding vertex.
Definition
Let G be a digraph. The indegree of a vertex v is the number of arcs
entering v. The outdegree of v is the number of arcs leaving v.
Mark W. Spong Dynamics of Complex Networks and Systems
Graphs and MatricesIncidence Matrix
Another useful matrix characterization of a graph is the so-called
http://goforward/http://find/http://goback/
-
8/13/2019 Lecture 2 Graph Theory
78/119
Another useful matrix characterization of a graph is the so calledIncidence Matrix.
Definition
The Incidence Matrix of a graph G of order n and size m is the n × mmatrix M = (mi,j) with mi,j = 1 if vertex i is incident with edge j andzero otherwise.
Example
The figure below shows a graph and corresponding incidence matrix.
v1 v2
v3v4
e1
e
2
e3
e
4
e5
M =
1 0 0 1 01 1 0 0 10 1 1 0 00 0 1 1 1
Mark W. Spong Dynamics of Complex Networks and Systems
Graphs and MatricesGraph Laplacian
http://find/
-
8/13/2019 Lecture 2 Graph Theory
79/119
Next we define the Laplacian or Laplacian Matrix of a graph as follows:
Definition
Given a simple graph with n vertices, the Laplacian Matrix, L = (ij) isdefined as
ij =
deg(vi) if i = j
−1 if i = j and vi is adjacent to vj0 otherwise
It is easy to show that the Laplacian L = D − A, where D is a diagonalmatrix with the vertex degrees on the diagonal and A is the adjacency
matrix. The Laplacian is useful in several ways; for determining thenumber of connected components of the graph, determining the numberof spanning trees and other applications.
Mark W. Spong Dynamics of Complex Networks and Systems
Graphs and MatricesExample
Example
http://find/
-
8/13/2019 Lecture 2 Graph Theory
80/119
Consider the graph and associated Laplacian matrix below:
L =
2 −1 0 0 −1 0−1 3 −1 0 −1 0
0 −1 3 −1 −1 00 0 −1 3 0 −1
−1 −1 −1 −1 4 0
0 0 0 −1 0 −1
Remark
It is easy to see that the sum of the elements in each row is equal to
zero.This means that the vector x = (1, 1, . . . , 1)T satisfies Lx = 0.
As a consequence, the Laplacian is never invertible and 0 is alwaysan eigenvalue of the Laplacian.
Mark W. Spong Dynamics of Complex Networks and Systems
Graphs and MatricesEigenvalues of the Adjacency and Laplacian Matrices
http://goforward/http://find/http://goback/
-
8/13/2019 Lecture 2 Graph Theory
81/119
Both the Adjacency and the Laplacian matrices are symmetric.
This means that all of their eigenvalues are real.
Definition
The Spectral Radius ρ(G) of a graph G is the largest eigenvalue of the
adjacency matrix A(G).The Spectral Gap σ(G) of a graph G is the largest eigenvalue of theLaplacian matrix L(G).
Later we will use the spectral radius to explain, for example, howepidemics travel through a network and we will use the spectral gap toexplain stability, or lack of it, in a network.
Mark W. Spong Dynamics of Complex Networks and Systems
Graphs and MatricesAdditional Properties of the Laplacian
A direct calculation shows that
http://find/
-
8/13/2019 Lecture 2 Graph Theory
82/119
A direct calculation shows that
xT
Lx =
xixj∈E (G)(xi − xj)
2
≥ 0
As a consequence, the Laplacian matrix is Positive Semi-definite.
This means that the eigenvalues of L are non-negative.
Let 0 = λ0 ≤ λ1 ≤ · · · ≤ λn be the n eigenvalues of L ordered fromsmallest to largest.
The multiplicity of the zero eigenvalue is the number of connectedcomponents of G.
If G is connected, therefore, λ0 is the only zero eigenvalue.λ1 is called the algebraic connectivity of G and is a measure of how well the overall graph is connected.
Mark W. Spong Dynamics of Complex Networks and Systems
Graphs and MatricesLaplacian Matrix for a Complete Graph
For the complete graph K n with n vertices, each diagonal entry of theLaplacian matrix is n − 1 and all other entries are equal to −1. From
http://find/
-
8/13/2019 Lecture 2 Graph Theory
83/119
p qthis we can show that the nonzero eigenvalues, λ1, . . . , λn−1 are all equal
to n, the order of the graph.Proof
The eigenvectors associated with eigenvalues λ1, . . . λn−1 form ann − 1-dimensional subspace orthogonal to the vector x = [1, 1, . . . , 1].Let v be any vector orthogonal to x. Then
ni=1
vi = 0
Computing the j-th entry of Lv gives
(Lv)j = (n − 1)vj −i=j
vi = nvj
Therefore, n is an eigenvalue and any vector orthogonal to x
is an ei envector for n Mark W. Spong Dynamics of Complex Networks and Systems
TreesIn this lecture we will discuss Trees, which form an important subclass of graphs.
http://find/
-
8/13/2019 Lecture 2 Graph Theory
84/119
Trees find applications in efficient data storage and search methods in
computer science, in transportation networks, in project management(PERT), and a host of other applications.
Definition
A Tree is a connected simple graph with no cycles. Note: Without the
requirement of being connected, the graph is called a Forest.
Mark W. Spong Dynamics of Complex Networks and Systems
TreesBasic Results
W ill i f b i th b t t h f
http://find/
-
8/13/2019 Lecture 2 Graph Theory
85/119
We will now give a sequence of basic theorems about trees, whose proofsare fairly straightforward.
Theorem
For any connected, simple, graph G with n vertices and m edges,n ≤ m + 1.
Proof: We can equivalently show m ≥ n − 1. Clearly, m = n − 1 for agraph with n = 2 and m = 1. It is also clear that any connected graphcan be built from a graph with n = 2 and m = 1 by sequentially addingnodes and edges one at a time. To maintain connectivity, any time anode is added, one edge must be added. On the other hand, an edge can
be added between two existing vertices, thereby creating a cycle, withoutincreasing the number of vertices. Therefore, the number of edges isalways greater than or equal to n − 1.
Mark W. Spong Dynamics of Complex Networks and Systems
TreesBasic Results
http://find/
-
8/13/2019 Lecture 2 Graph Theory
86/119
From the proof of the previous theorem it is clear that m = n − 1 for atree, since there are no cycles. Likewise, one can easily show
Theorem
Any connected simple graph with m vertices and m edges for whichn = m − 1 is a tree.
A graph is a tree if and only if there is exactly one path between any pair of vertices u and v.
An edge e of a graph G is a cut edge if and only if e is not part of any cycle of G.
A connected graph G is a tree if and only if every edge is a cut edge.
Mark W. Spong Dynamics of Complex Networks and Systems
TreesSpanning Trees
http://find/
-
8/13/2019 Lecture 2 Graph Theory
87/119
Definition
Let G be a connected graph. An acyclic connected subgraph S of Gcontaining all of the vertices of G is called a Spanning Tree.
Graph G and Spanning Tree H (bold edges)
Mark W. Spong Dynamics of Complex Networks and Systems
TreesMinimal Connector Problem
http://find/
-
8/13/2019 Lecture 2 Graph Theory
88/119
The Minimal Connector Problem or Minimal Spanning Tree
Problem is to find a spanning tree T in a network N whose value (thesum of values of its edges) is minimum.
Kruskal’s Algorithm
Given a network N choose any edge e1 of N of minimal value. Next
choose edge e2 to be any remaining edge of minimal value. For e3choose any remaining edge of minimal value which does not form a cyclewith the previous edges. We continue this procedure until a spanning treeis obtained. A spanning tree arrived at in this way is called an EconomyTree.
Note that there is no requirement that an edge chosen at a given stepmust maintain connectivity.
Mark W. Spong Dynamics of Complex Networks and Systems
TreesExample
Example
http://find/
-
8/13/2019 Lecture 2 Graph Theory
89/119
Example
Consider the connected network N below.
Mark W Spong Dynamics of Complex Networks and Systems
TreesStep 1
http://find/
-
8/13/2019 Lecture 2 Graph Theory
90/119
Mark W Spong Dynamics of Complex Networks and Systems
TreesStep 2
http://find/
-
8/13/2019 Lecture 2 Graph Theory
91/119
Mark W Spong Dynamics of Complex Networks and Systems
TreesStep 3
http://goforward/http://find/http://goback/
-
8/13/2019 Lecture 2 Graph Theory
92/119
Mark W Spong Dynamics of Complex Networks and Systems
TreesStep 4
http://find/
-
8/13/2019 Lecture 2 Graph Theory
93/119
Mark W Spong Dynamics of Complex Networks and Systems
TreesStep 5
http://find/
-
8/13/2019 Lecture 2 Graph Theory
94/119
Mark W Spong Dynamics of Complex Networks and Systems
TreesStep 6
http://find/
-
8/13/2019 Lecture 2 Graph Theory
95/119
Mark W Spong Dynamics of Complex Networks and Systems
TreesStep 7
http://find/
-
8/13/2019 Lecture 2 Graph Theory
96/119
Mark W Spong Dynamics of Complex Networks and Systems
TreesThe Resulting Economy Network
http://find/
-
8/13/2019 Lecture 2 Graph Theory
97/119
Mark W Spong Dynamics of Complex Networks and Systems
TreesSolution of the Minimal Connector Problem
http://find/
-
8/13/2019 Lecture 2 Graph Theory
98/119
TheoremLet G be a connected network and let T be an economy tree of G. ThenT is a spanning tree whose value is minimal.
Proof: We need to show that if T 0 is any other spanning tree of G then
the value of T 0 is at least as large as the value of T . Denote by f (e) thevalue of edge e. Then the value of the tree T is
f (T ) =
f (e)
where the summation is taken over all of the edges of T .
Mark W Spong Dynamics of Complex Networks and Systems
TreesSolution of the Minimal Connector Problem
If the network G has order p, then the economy tree T has p − 1 edges.L h d f T b d d
http://find/
-
8/13/2019 Lecture 2 Graph Theory
99/119
Let the edges of T be ordered as e1, e2, . . . , e p−1.
If T 0 and T are not identical, let ei be the first edge of T in the abovesequence not in T 0.
Add the edge ei to T 0 obtaining a network G0. Suppose ei = uv.
Then a u − v path P exists in T 0 so P together with ei forms a cycle C
in G0.
Since T contains no cycles let e0 be an edge in C that is not in T .
The graph T
0 = G0 − e0 is also a spanning tree of G and
f (T
0) = f (T 0) + f (ei) − f (e0)
Mark W Spong Dynamics of Complex Networks and Systems
TreesSolution of the Minimal Connector Problem
Si f (T ) ≤ f (T
) it f ll th t
http://find/
-
8/13/2019 Lecture 2 Graph Theory
100/119
Since f (T 0) ≤ f (T 0) it follows that
f (e0) − f (ei) = f (T 0) − f (T
0) ≤ 0
i.e. f (e0) ≤ f (ei). However, given the above construction, ei is an edgeof smallest value that can be added to the edges e1, . . . , ei−1 without
producing a cycle. Also if e0 is added to the edges e1, . . . , ei−1 no cycleis produced either. Therefore f (ei) = f (e0) so that f (T 0) = f (T
0). Wehave shown the existence of a spanning tree T
0 of minimum value suchthat the number of edges common to T
0 and T exceeds the number of edges common to T 0 and T by one edge, namely ei. By continuing thisprocedure we can construct a spanning tree with minimum value identical
to T . Therefore the economy tree T has minimum value.
M k W S D i s f C le Net ks d S ste s
TreesPERT and the Critical Path Method
The management sciences contain many examples of very complexplanning and scheduling problems. Graph theory can be useful tosystematically analyze and plan large scale projects Techniques referred
http://find/
-
8/13/2019 Lecture 2 Graph Theory
101/119
systematically analyze and plan large-scale projects. Techniques referred
to as PERT (Program Evaluation and Review Technique) and CPM(Critical Path Methods) use Activity Digraphs to model projectactivities.
Mark W. Spong Dynamics of Complex Networks and Systems
TreesExample
Let’s look at a simple example. Suppose we want to convert a basement
http://find/
-
8/13/2019 Lecture 2 Graph Theory
102/119
p p pp
area into a game room. The work involves four activities, paneling thewalls, installing a ceiling, carpeting the floor, and assembling a pooltable. To make things easier the carpet should be installed beforeassembling the pool table.
Activity T ime(hours)
A Assemble the pool table 4B Carpet the floor 6C Panel the walls 6D Install the ceiling 8
An Activity digraph is constructed from the list of activities by adding
nodes S (Start) and E (End) to the list of nodes together with theactivities A, B,C, D.
Mark W. Spong Dynamics of Complex Networks and Systems
TreesActivity Digraph
http://goforward/http://find/http://goback/
-
8/13/2019 Lecture 2 Graph Theory
103/119
The vertex S is directed to a vertex v if activity v may start without anyother activity first being completed. The vertex w is directed to E if noactivity requires that w be completed before that activity begins. Finally,
vertex x is directed to vertex y if and only if no activity needs to intervenebetween the completion of x and the beginning of y. The weight of edgevivj corresponds to the time needed to complete activity vj .
Mark W. Spong Dynamics of Complex Networks and Systems
TreesCritical Path
Definition
A longest path (in terms of time) in an activity digraph is called a
http://find/
-
8/13/2019 Lecture 2 Graph Theory
104/119
A longest path (in terms of time) in an activity digraph is called a
Critical Path. The length of the critical path equals the minimum timenecessary to complete the project.
The above activity digraph has exactly one critical path S, B, A, E andthe time length is 10 hours. In practice, the problems are obviously much
more complex and there are software packages available to constructPERT charts.
Example
Explain why the graph below cannot be an activity digraph.
Mark W. Spong Dynamics of Complex Networks and Systems
Graph TheoryBipartite Graphs
Definition
A Bipartite Graph is a special type of graph G whose vertices can be
http://find/
-
8/13/2019 Lecture 2 Graph Theory
105/119
A Bipartite Graph is a special type of graph G whose vertices can be
partitioned into two sets V 1 and V 2 so that every edge of G joins avertex of V 1 to a vertex of V 2 and no vertex is connected to anothervertex in its own set.
Example
The graph below is an example of a bipartite graph
v1 v2 v3 v4 v5
u1 u2 u3 u4 u5
Mark W. Spong Dynamics of Complex Networks and Systems
Graph TheoryBipartite Graphs
Theorem
A graph is bipartite if and only if it contains no odd cycles.
http://find/
-
8/13/2019 Lecture 2 Graph Theory
106/119
Corollary
Since trees have no cycles we can state immediately that every tree isbipartite.
Example
The graphs below show a tree and the corresponding bipartite representation.
v1
v2
v3
v4 v5 v6 v7 v1 v4 v5 v6 v7
v2 v3
Mark W. Spong Dynamics of Complex Networks and Systems
Graph TheoryGraph Embeddings
The way a graph is represented is often important as a way to gain
http://find/
-
8/13/2019 Lecture 2 Graph Theory
107/119
insight into its structure.By a Graph Embedding we mean a particular drawing or representationof a graph.
Some standard way to represent a graph include:
circular embeddingranked embedding
spring embedding
lattice embedding
Mark W. Spong Dynamics of Complex Networks and Systems
Graph TheoryGraph Embeddings
http://find/
-
8/13/2019 Lecture 2 Graph Theory
108/119
The figure below shows several different embeddngs of a cube
Mark W. Spong Dynamics of Complex Networks and Systems
Graph TheoryRanked Embeddings
Bipartite graphs are sometimes drawn as Ranked Embeddings. Considerthe circular graph shown below. Although it is not obvious, this isactually a bipartite graph We can show this by considering the distance
http://find/
-
8/13/2019 Lecture 2 Graph Theory
109/119
actually a bipartite graph. We can show this by considering the distancebetween each vertex v and all other vertices. Here, by distance betweenvertices we mean the length of the shortest path connecting them.
Mark W. Spong Dynamics of Complex Networks and Systems
Graph TheoryBipartite Graphs
Now, select an arbitrary vertex v and select all vertices at distance 1 fromv, then at distance 2 from v and so on. We draw the vertices at a givenfixed distance from v along a horizontal line as shown below. One can
http://find/
-
8/13/2019 Lecture 2 Graph Theory
110/119
see that there are no edges between vertices at the same distance from v.Hence the graph is bipartite; one subset consisting of an even distance tov and the other consisting of vertices at an odd distance to v.
Mark W. Spong Dynamics of Complex Networks and Systems
Graph TheoryExercise
Exercise
Consider the circular graph below
http://find/
-
8/13/2019 Lecture 2 Graph Theory
111/119
1
23
4
5
6 7
8
Show that this can be redrawn as the bipartite graph below
1
2
3
4
5
6
7
8
Note that this is another embedding of the cube.
Mark W. Spong Dynamics of Complex Networks and Systems
Graph TheoryApplications
Bipartite graphs are useful for modeling so-called matching problems.An example of bipartite graph is a job matching problem. Suppose wehave a set N of people and a set M of jobs with not all people suitable
http://find/
-
8/13/2019 Lecture 2 Graph Theory
112/119
have a set N of people and a set M of jobs, with not all people suitablefor all jobs. We can model this as a bipartite graph (N , M , E ). If aperson ni is suitable for a certain job mj there is an edge between ni andmj in the graph.
Bipartite graphs are also extensively used in modern Coding theory,especially to decode codewords received from the channel.
In computer science, a Petri net is a mathematical modeling tool used inanalysis and simulations of concurrent systems. A system is modeled as abipartite directed graph with two sets of nodes: A set of place nodesthat contain resources, and a set of event nodes which generate and/or
consume resources. Petri nets utilize the properties of bipartite directedgraphs and other properties to allow mathematical proofs of the behaviorof systems while also allowing easy implementation of simulations of thesystem.
Mark W. Spong Dynamics of Complex Networks and Systems
Graph TheoryPlanar Graphs
Definition
http://find/
-
8/13/2019 Lecture 2 Graph Theory
113/119
A Planar Graph is a graph such that no two edges intersect.
Example
Note that one must be careful when determining whether or not a graphis planar. A seemingly non-planar graph can sometimes be redrawn so that it is planar.
The above two graphs are isomorphic and so both are planar.
Mark W. Spong Dynamics of Complex Networks and Systems
Graph TheoryPlanar Graphs
Applications of Planar Graphs
http://find/
-
8/13/2019 Lecture 2 Graph Theory
114/119
Applications of Planar Graphs
Planar graphs arise in Transportation Networks. If a graphcorresponding to a transportation network is planar then there is noneed for tunnels and bridges.
In the design of electrical circuits, planar networks mean that wires
do not have to cross. Complex computer chips are designed inlayers so that each layer is represented as a planar graph. There area number of other important applications of planar graphs.
We will next give some interesting characterizations and propertiesof planar graphs.
Mark W. Spong Dynamics of Complex Networks and Systems
Graph TheoryEuler’s Formula
A planar graph encloses a number of Regions, r1, . . . , rn, where wecount the region exterior to the graph as region r1. Given such a planar
http://find/
-
8/13/2019 Lecture 2 Graph Theory
115/119
graph with n vertices, m edges and r regions, the relationship amongthese quantities was formulated by Leonard Euler in his famous formula:
n − m + r = 2
Mark W. Spong Dynamics of Complex Networks and Systems
Graph TheoryEuler’s Formula
Proof: The proof is by induction on r, the number of regions. If r = 1then there can be no regions enclosed by edges of G. Thus G must be
http://find/
-
8/13/2019 Lecture 2 Graph Theory
116/119
then there can be no regions enclosed by edges of G. Thus G must beacyclic in which case m = n − 1. Thus n − m + r = n − (n − 1) + 1 = 2.Therefore Euler’s formula is true for r = 1.
Now assume that the formula is true for all planar graphs with less than rregions and choose a graph with r > 1. Choose an edge e, which is not
a cut edge, and let G1 = G − e. Since e is part of a cycle, removing eresults in two merged regions, reducing the number of regions by 1. ForG1, therefore, we know the formula is true. Therefore,
V (G1) − E (G1) + (r − 1) = 2
Since V (G1) = V (G) and E (G1) = E (G) − 1. Substituting these intothe above equation gives the result.
Mark W. Spong Dynamics of Complex Networks and Systems
Graph TheoryEuler’s Formula
Euler’s formula can be used for, among other things, determiningwhether a given graph is planar.
Theorem
http://find/
-
8/13/2019 Lecture 2 Graph Theory
117/119
For any connected simple planar graph G with n ≥ 3 vertices and medges, we have that m ≤ 3n − 6.
Proof: Consider a region f in any planar graph G. For any interiorregion, let B(f ) denote the number of edges by which f is enclosed, i.e.the length of its “border.” Clearly, B(f ) ≥ 3. However, with n ≥ 3 wealso have that the exterior region is “bounded” by at least 3 edges.Therefore, if there are a total of r regions, then
B(f ) ≥ 3r. On the
other hand, it is easy to see that
B(f ) counts every edge in G once ortwice and hence B(f ) ≤ 2m so that 3r ≤ B(f ) ≤ 2m and sor ≤ 23m. From Euler’s formula, therefore, we havem = n + r − 2 ≤ n + 23m − 2 so that m ≤ 3n − 6.
Note that the above result means that, if we have a simple graph inwhich m > 3n − 6, then it cannot be planar.
Mark W. Spong Dynamics of Complex Networks and Systems
Graph TheoryEuler’s Formula
Example
http://find/
-
8/13/2019 Lecture 2 Graph Theory
118/119
The complete graph K 5 on five vertices is non-planar.
v1
v2
v3
v4 v4
K 5
In the graph K 5, n = 5 and m = 10 so 3n − 6 = 9 > m and so the graph cannot be planar.
Mark W. Spong Dynamics of Complex Networks and Systems
Graph TheoryPlanar Graphs
Example
http://find/
-
8/13/2019 Lecture 2 Graph Theory
119/119
Is the complete graph K 4 planar? v1v2
v3 v4
K 4
Mark W. Spong Dynamics of Complex Networks and Systems
http://find/