5. 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کنید کلیک
7. 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
8. 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
10. 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
11. 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
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
𝟐
12
13. 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
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 w w w
s
b
a
c
d
2
3
7
2
1
5
4
80
𝟏𝟎𝟓
𝟕
5
14
15. 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
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 w w
s
b
a
c
d
2
3
7
2
1
5
4
80
𝟔𝟓
𝟕
5
16
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 w
s
b
a
c
d
2
3
7
2
1
5
4
80
𝟔𝟓
𝟕
5
𝟏𝟏
17
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
7
2
1
5
4
80
𝟔𝟓
𝟕
5
18
19. 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
20. 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
21. Kruskal's algorithm (Minimum Spanning Tree
(MST))
Joseph Bernard Kruskal
American mathematician, statistician,
computer scientist and psychometrician
21
32. 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
33. 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
34. 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
49. 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
50. Graph Partitioning (GP)
Used to:
reduce complexity
parallelization
Application problems like:
social network,
road network,
air traffic control,
image analysis
etc.
50
51. Common Applications of Graph Partitioning
Finite Element Method / Scientific Computing
Customizable Route Planning
51
52. 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
53. 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
54. 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
55. 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
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.
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.