Graph Theory
1
History of Graph Theory
Leonard
Euler
1736
Gustav
Kirchhoff
1847
22
Graph Theory
 Chemical engineering
 Electrical engineering
 Civil Engineering
 Architectural Engineering
 Computer engineering
 ........
Journal of Graph Theory
network representing electricity
markets
3
Graph Definition
multiple members
Loop simple graph
Adjacency and Incidence
Degree of a node
44
Graph Definition
 Walk
 Path
 Trail
 Cycle
A path is a walk that does not include any edge and vertex twice.
A walk is an alternating sequence of vertices and connecting
edges.
A cycle is a path that begins and
ends on the same vertex.
A trail is a walk that does not pass over the same edge twice. A
trail might visit the same vertex twice, but only if it comes and
goes from a different edge each time.
5
‫متن‬ ‫ترجمه‬‫م‬ ‫شما‬ ‫به‬ ‫را‬ ‫امکان‬ ‫این‬ ‫ایرانیان‬ ‫تخصصی‬ ‫ترجمه‬ ‫در‬‫ی‬
‫ترجمه‬ ‫راحتی‬ ‫به‬ ‫را‬ ‫خود‬ ‫های‬ ‫پروژه‬ ‫و‬ ‫پاورپوینت‬ ‫انواع‬ ‫که‬ ‫دهد‬
‫کنید‬.
‫روی‬ ‫بر‬ ‫است‬ ‫کافی‬ ‫ترجمه‬ ‫سفارش‬ ‫برای‬
http://iraniantranslate.com/index.php‫کنید‬ ‫کلیک‬
Graph types
 Connected graph
 Complete graph
 Bipartite graph
 Complete bipartite graph
 Hamiltonian graph
 Directed graph
 Planar graph
 Weighted graph
 Tree
 Spanning Tree
 Forrest
e=n(n-1)/2
6
Tree
 Shortest Path Tree (SPT)
 Dijkstra's algorithm
 Minimum Spanning Tree (MST)
 Kruskal's algorithm
 Prim's algorithm
 Reverse-delete algorithm
 Borůvka's algorithm
7
Dijkstra's algorithm
 Both directed and undirected graphs
 All edges must have nonnegative weights
 Graph must be connected
How do we get from 2-151 to Logan?
8
Pseudocode of Dijkstra's algorithm
9
Example of Dijkstra's algorithm
v s a b c d
d.[v] 0 ∞ ∞ ∞ ∞
Prev.[v] null null null null null
Color[v] w w w w w
s
b
a
c
d
2
3
7
2
1
5
4
80
∞∞
∞∞
5
10
Example of Dijkstra's algorithm
v s a b c d
d.[v] 0 ∞ ∞ ∞ ∞
Prev.[v] null null null null null
Color[v] b w w w w
s
b
a
c
d
2
3
7
2
1
5
4
80
∞
𝟕
∞∞
𝟐
∞
5
11
Example of Dijkstra's algorithm
v s a b c d
d.[v] 0 2 7 ∞ ∞
Prev.[v] null s s null null
Color[v] b b w w w
s
b
a
c
d
2
3
7
2
1
5
4
80
∞𝟕
∞
5
𝟐
12
Example of Dijkstra's algorithm
v s a b c d
d.[v] 0 2 7 ∞ ∞
Prev.[v] null s s null null
Color[v] b b w w w
s
b
a
c
d
2
3
7
2
1
5
4
80
∞𝟕
∞
𝟓 𝟏𝟎
𝟕
5
13
Example of Dijkstra's algorithm
v s a b c d
d.[v] 0 2 5 10 7
Prev.[v] null s a a a
Color[v] b b w w w
s
b
a
c
d
2
3
7
2
1
5
4
80
𝟏𝟎𝟓
𝟕
5
14
Example of Dijkstra's algorithm
v s a b c d
d.[v] 0 2 5 10 7
Prev.[v] null s a a a
Color[v] b b b w w
s
b
a
c
d
2
3
7
2
1
5
4
80
𝟏𝟎𝟓
𝟕
𝟔
5
15
Example of Dijkstra's algorithm
v s a b c d
d.[v] 0 2 5 6 7
Prev.[v] null s a b a
Color[v] b b b w w
s
b
a
c
d
2
3
7
2
1
5
4
80
𝟔𝟓
𝟕
5
16
Example of Dijkstra's algorithm
v s a b c d
d.[v] 0 2 5 6 7
Prev.[v] null s a b a
Color[v] b b b b w
s
b
a
c
d
2
3
7
2
1
5
4
80
𝟔𝟓
𝟕
5
𝟏𝟏
17
Example of Dijkstra's algorithm
v s a b c d
d.[v] 0 2 5 6 7
Prev.[v] null s a b a
Color[v] b b b b b
s
b
a
c
d
2
3
7
2
1
5
4
80
𝟔𝟓
𝟕
5
18
Example of Dijkstra's algorithm
v s a b c d
d.[v] 0 2 5 6 7
Prev.[v] null s a b a
Color[v] b b b b b
s
b
a
c
d
2
3
1
5
0
𝟔𝟓
𝟕
19
Complexity of Dijkstra's algorithm
 binary heap vs binomial heap
 Fibonacci heap
O(V log V + E log V)
O(V log V + E)
20
Kruskal's algorithm (Minimum Spanning Tree
(MST))
Joseph Bernard Kruskal
American mathematician, statistician,
computer scientist and psychometrician
21
Pseudocode of Kruskal's algorithm
22
Kruskal's algorithm
A
5
G
F
E
C
B
D
7
3 12
4
9
6
15
8
10
7
23
Kruskal's algorithm
A
5
G
F
E
C
B
D
7
3 12
4
9
6
15
8
10
7
24
Kruskal's algorithm
A
5
G
F
E
C
B
D
7
3 12
4
9
6
15
8
10
7
25
Kruskal's algorithm
A
5
G
F
E
C
B
D
7
3 12
4
9
6
15
8
10
7
26
Kruskal's algorithm
A
5
G
F
E
C
B
D
7
3 12
4
9
6
15
8
10
7
27
Kruskal's algorithm
A
5
G
F
E
C
B
D
7
3 12
4
9
6
15
8
10
7
28
Kruskal's algorithm
A
5
G
F
E
C
B
D
7
3 12
4
9
6
15
8
10
7
29
Kruskal's algorithm
A
5
G
F
E
C
B
D
7
3 12
4
9
6
15
8
10
7
30
Kruskal's algorithm
A
5
G
F
E
C
B
D
3
4 6
8
7∑𝑊 = 33
31
Complexity of Kruskal's algorithm
 first sort the edges by weight using a comparison sort in O(E log E) time
this allows the step "remove an edge with minimum weight from S" to
operate in constant time. Next, we use a disjoint-set data structure (Union&Find)
to keep track of which vertices are in which components.
32
Prim's algorithm
 Prim's algorithm is a greedy algorithm that finds a minimum
spanning tree for a weighted undirected graph
 This means it finds a subset of the edges that forms a tree that
includes every vertex, where the total weight of all the edges in
the tree is minimized.
33
Prim's algorithm
1. Start at any node in the graph
 Mark the Starting node as Reached.
 Mark all the other nodes in the graph as unreached.
Right now, the minimum Spanning Tree (MST) consists of the starting node.
2. Find an edge e with minimum cost in the graph that connects:
 A reached node x to an unreached node y.
3. Add the edge e found in the previous step to the Minimum cost spanning Tree
Mark the unreached node y as reached.
4. Repeat the step 2 and 3 until all nodes in the graph have become reached
34
Prim's algorithm
5
A
B
D
F
E
G
C7
3 12
4
9
6
15
8
10
7
Starting Node
Reached node
Unreached node
35
Prim's algorithm
5
A
B
D
F
E
G
C7
3 12
4
9
6
15
8
10
7
Starting Node
Reached node
Unreached node
36
Prim's algorithm
5
A
B
D
F
E
G
C7
3 12
4
9
6
15
8
10
7
Starting Node
Reached node
Unreached node
37
Prim's algorithm
5
A
B
D
F
E
G
C7
3 12
4
9
6
15
8
10
7
Starting Node
Reached node
Unreached node
38
Prim's algorithm
5
A
B
D
F
E
G
C7
3 12
4
9
6
15
8
10
7
Starting Node
Reached node
Unreached node
39
Prim's algorithm
5
A
B
D
F
E
G
C7
3 12
4
9
6
15
8
10
7
Starting Node
Reached node
Unreached node
40
Prim's algorithm
5
A
B
D
F
E
G
C7
3 12
4
9
6
15
8
10
7
Starting Node
Reached node
Unreached node
41
Prim's algorithm
5
A
B
D
F
E
G
C7
3 12
4
9
6
15
8
10
7
Starting Node
Reached node
Unreached node
42
Prim's algorithm
5
A
B
D
F
E
G
C7
3 12
4
9
6
15
8
10
7
Starting Node
Reached node
Unreached node
43
Prim's algorithm
5
A
B
D
F
E
G
C7
3 12
4
9
6
15
8
10
7
Starting Node
Reached node
Unreached node
44
Prim's algorithm
5
A
B
D
F
E
G
C7
3 12
4
9
6
15
8
10
7
Starting Node
Reached node
Unreached node
45
Prim's algorithm
5
A
B
D
F
E
G
C7
3 12
4
9
6
15
8
10
7
Starting Node
Reached node
Unreached node
46
Prim's algorithm
5
A
B
D
F
E
G
C7
3 12
4
9
6
15
8
10
7
Starting Node
Reached node
Unreached node
47
Prim's algorithm
5
A
B
D
F
E
G
C
3
4 6
8
7
Starting Node
Reached node
Unreached node
∑𝑊 = 33
48
Complexity of Prim's algorithm
 V={v1, v2, v3 ,…}
 For v1 : time complexity is O(V)
 So you have V steps (V vertexes to add) each taking cost V,
which gives you O(V^2)
49
Graph Partitioning (GP)
Used to:
 reduce complexity
 parallelization
Application problems like:
 social network,
 road network,
 air traffic control,
 image analysis
 etc.
50
Common Applications of Graph Partitioning
 Finite Element Method / Scientific Computing
 Customizable Route Planning
51
Graph Partitioning (GP)
 the graph partitioning problem asks for blocks of nodes V1,. . . ,Vk that partition the
node set V
An example graph that is partitioned into four blocks. The
partition has 17 cut edges. The weights of the blocks are
blue(10), red(8), green(7) and purple(8).
52
Graph Partitioning (GP)
 An abstract view of the partitioned graph is the so called quotient
graph, where nodes represent blocks and edges are induced by
connectivity between blocks, i.e. there is an edge in the quotient
graph if there is an edge that runs between the blocks in the
original, partitioned graph. An example is given in following
Figure
A graph that is partitioned into three blocks of size four on the left and its
corresponding quotient graph on the right. There is an edge in the quotient graph if
there is an edge between the corresponding blocks in the original graph.
53
Objective Functions of Graph Partitioning (GP)
we often seek to find a partition that minimizes (or maximizes) an objective.
Probably the most prominent objective function is to minimize the total cut.
A typical model of computation and communication.
54
References
 A. Kaveh, Structural Mechanics: Graph and Matrix Methods, Research Studies
Press (John Wiley), Exeter, U.K., 1992 (first edition), 1995 (second edition), 2004 (third
edition)
 Singh, Rishi Pal. "Application of Graph Theory in Computer Science and
Engineering." International Journal of Computer Applications 104.1 (2014).
 Shekhawat, Krishnendra. "Mathematical propositions associated with the connectivity
of architectural designs." Ain Shams Engineering Journal (2015).
 Grimm, Veronika, et al. "Transmission and generation investment in electricity markets:
The effects of market splitting and network fee regimes." European Journal of
Operational Research 254.2 (2016): 493-509.
55
Thanks for your attention
56

Graph theory

Editor's Notes

  • #6 Less formally a walk is any route through a graph from vertex to vertex along edges. A walk can end on the same vertex on which it began or on a different vertex. A walk can travel over any edge and any vertex any number of times.
  • #8 We wish to build a railroad networks connecting n given cities so that a passenger can travel from any city to another. For economic reasons you want to minimize the total amount of track.