08 Networks + Short Route + Spanning 20241209
08 Networks + Short Route + Spanning 20241209
3. Social Networks:
- Social Network Analysis: Graphs model relationships and interactions in social networks, helping to
understand patterns and structures in social systems.
6. Cryptography:
- Key Management: Graphs are used in the study of cryptographic algorithms and protocols, particularly
in the management of cryptographic keys.
In the Facebook network model, there are three types of nodes which are users, posts
and groups. The links are friendship (red), reactions on posts (green), creation of posts
(blue), messages (pink) and group membership (purple). Four sub graphs can be extracted
from Facebook network model to analyze the user behavior of Facebook. They are;
Friendship graph, Graph for reacting on posts, Groups graph, Messaging graph.
Network Example
Transportation
network • This kind of network
is called bipartite
graph (or bigraph),
a graph whose vertices
can be divided into
two disjoint sets
• There is no
connection among
sources or among
destinations
7
7-7
Applications
8
The Shortest Route Problem
Definition and Example Problem Data (1 of 2)
Problem: Determine the shortest routes (shortest travel time) from the origin
to all destinations.
5
4 6
2
3
1
The Shortest Route Problem
Definition and Example Problem Data (2 of 2)
Network Representation
The Shortest Route Problem
Solution Approach (1 of 8)
Select origin. Put the origin in permanent set. Determine all nodes directly connected
to the permanent set. Determine the initial shortest route from the origin (node
1) to the closest node. Mark the node with the shortest time from origin. Mark
the branch as well.
22
What is a Spanning Tree?
Consider the
following Graph G 4 vertices Spanning Tree
4 edges
n vertices
Connected
2 Edges have some weight n-1 edges
5
6 Form a cycle Does not form cycle
1
A graph can have… 2
3 5
n vertices
7 6
>=n edges
1 1
4 Connected & form a cycle
3
7
2
Consider a subgraph G’ of G 5 Sum of arc
4
lengths = 18
2 1
5
2
5
7
1
3 4 1
3
Tree Tree 7
<=n vertices <=n vertices 1
4 Sum of arc
<= n-1 edges <= n-1 edges
lengths = 13
Not connected Connected
23
Does not form cycle Does not form cycle
Minimal Spanning Tree Problem
• A tree is a subnetwork of a network that does not form a
cycle.
25
Network for Oil Pipeline Problem
Romania
Bellarus Italy
Turkey
Russia
Poland
Germany
26
Arbitrarily begin at any node and connect it to the closest node (shortest distance).
The two nodes are referred to as connected nodes, and the remaining nodes are
referred to as unconnected nodes.
27
Identify the unconnected node that is closest to one of the connected nodes (break ties
arbitrarily). Add this new node to the set of connected nodes. Repeat this step until all nodes
have been connected.
28
Repeat previous step until all nodes have been connected.
29
The length of pipe that will be needed for this system can be found by summing
the arc lengths:
18+13+22+18+24+32 = 127 30
Minimal Spanning Tree Algorithm
• Step 1: Arbitrarily begin at any node and connect it to the
closest node. The two nodes are referred to as connected
nodes, and the remaining nodes are referred to as
unconnected nodes.
1. Algorithm Paradigm:
• Prim's Algorithm: Prim's algorithm is greedy but works by growing
the minimum spanning tree one vertex at a time. It starts with an
arbitrary vertex and adds the edge with the smallest weight connecting
the growing tree to an external vertex at each step.
• Kruskal's Algorithm: Kruskal's algorithm is also a greedy approach,
sorting all the edges by weight and adding them to the growing
minimum spanning tree as long as they do not form a cycle.
2. Performance:
• Prim's Algorithm: Often more efficient on dense graphs (graphs
with many edges).
• Kruskal's Algorithm: Generally more efficient on sparse graphs
(graphs with fewer edges).
Exercise
Find the Minimal Spanning
Tree for the following
network
One solution:
Arcs:
0-1, 0-7, 2-8, 7-6, 2-5, 6-5, 2-3, 3-4
MST length=
4+8+4+2+1+7+2+9
= 37
Another solution:
Arcs
0-1, 1-2, 2-8, 7-6, 2-5, 6-5, 2-3, 3-4
=37
Backup