Complex Networks - Introduction to Graph Theory Lecture-2
Complex Networks - Introduction to Graph Theory Lecture-2
GE 2318
Instructor: G Ron Chen
Acknowledgement: Un-copyrighted photos and pictures were taken from the Internet
What is a Graph?
A graph is a diagrammatical
representation of some physical
structure
such as:
a circuit
a computer network
a human relation network
… and so on
Example
Euler (1707-1783) proved that the Königsburg
seven- bridge problem has no solution
Notation and Terminology
▪ In a graph, a node has no size and an edge has no width and length
A C D
Examples of General (non-simple) Graphs
5 2
weighted graphs
sometimes considered
1
Property:
Reasoning:
N-1 Examples:
1
Some Basic Properties
• Property:
The total node degree of a graph is always an even number.
• Property:
In a graph, the number of nodes of odd degrees must be even.
Examples:
Density of Graph
Existing Edges
Maximum possible
total number of edges
Existing
Edges
Existing
Edges
• Example:
1 2 3 4
1 2 1 01 0 1
2 10 1 1
A=
3 0 1 0 1
4 1 1 1 0
4 3
• Example:
1 2 3 4 5
1 1 2
11 0 0 1 0
21 1 0 0 1
M =
5
4 2
3 0 1 1 0 0
4 3 3 4 0 0 1 1 1
(generally non-square)
A graph may take different shapes
A graph may take different shapes
Bipartite Graphs
Bipartite Graphs
Bipartite Graphs
?
Tripartite Graphs
Tripartite Graph: All nodes are partitioned into three sets
in such a way that no two nodes contained in any one of
the three parts are adjacent
Trees
▪ Tree: A connected graph without any loop
▪ Forest: A family of unconnected trees
Trees
Bridges
Bridge: An edge, whose removal will disconnect the network
A simple path in a
maze is a chain
Or, at most,
including those
unsuccessful
attempts, is a tree
All loops are
redundant and
can be removed
Maze
A simple algorithm to build a maze
(1) Start with a grid that has every possible wall filled in
(2) Choose a boundary cell to begin
(3) From the current cell:
(3.1) If there are unvisited neighbors, randomly choose
one to move in
(3.2) If there are no unvisited neighbors, backtrack to the
previous cell, and search for an unvisited neighbor
(4) Continue till end
Explanation
Example
A
More about Trees
unique
B E
For example →
Two spanning
trees of a graph
C D
Minimum Connector Problem
▪ Minimum connector problem: Suppose that one
wants to build a highway network connecting some
cities, in such a way that a car can traverse from any
city to any other city but the total mileage of the
highways is minimum
2 6
2 6
6
E
B 4
8
5
8 3
7
C D
9
Method 1
Continue → Next shortest edge
2 6
6
E
B 4
8
5
8 3
7
C D
9
Method 1
Continue → Next shortest edge
2 6
6
E
B 4
8
5
8 3
7
C D
9
Method 1
Continue → Next shortest edge
Avoid loops ! A
2 6
6
E
B 4
8
5
8 3
7
Note: BD = 5 or
AE = 6 or BE= 6
C D
will form a circuit 9
Result
A
6
2
6
B E
4
8
5 8
7 3
No more edge
can be added
C 9 D
Method 2
Staring from the longest edge
Remove the edge to break loop
2 6
6
E
B 4
8
5
8 3
7
C D
9
Method 2
Staring from the longest edge
Remove the edge to break loop
2 6
6
E
B 4
8
5
8 3
7
C D
Method 2
Staring from the longest edge
Remove the edge to break loop
2 6
6
E
B 4
8
5
3
7
C D
Method 2
Staring from the longest edge
Remove the edge to break loop
2 6
6
E
B 4
5
3
7
C D
Method 2
Staring from the longest edge
Remove the edge to break loop
2 6
E
B 4
5
3
7
C D
Method 2
Staring from the longest edge
Remove the edge to break loop
E
B 4
5
3
7
C D
Method 2
Staring from the longest edge
Remove the edge to break loop
E
B 4
3
7
C D
Result
A
6
2
6
B E
4
8
5 8
7 3
No more edge
can be removed
C 9 D
BREAK
10 minutes
Eulerian Graphs
Eulerian graph:
Property:
A graph is Eulerian if and only if All notes have even degrees
Examples:
Semi-Eulerian Graphs
Semi-Eulerian graph:
Ideas:
To have a solution, the graph must be Eulerian
Example:
Steps:
(1) Make the graph be Eulerian by adding edges Post Street
Office
to nodes with odd degrees (sometimes also
some nodes with even degrees) Solution:
d 8 c
o o
5 5
6 6
5 Post 5
Office The center
node had an
a 8 b even degree.
After adding
o repeated
(a) streets, it
should still
have an even
degree.
(b) Add:
8
5
6 ab + dc = 8 + 8 = 16
o o
(c) Add:
ad + bc = 6 + 6 = 12
(d) Add:
o ao + bo + co + do
=5+5+5+5
= 20
Kuan Mei-Ko (2016)
Sir William Rowan Hamilton (1805-1865)
In 1856, the English mathematician William R. Hamilton
studied the world navigation problem and considered a
map with 20 nodes representing cities connected by
sailing routes, as depicted by the following figure. He
wanted to find out if one can traverse through every city
once and once only, and finally return to the starting city.
His study eventually led to the establishment of the now-
famous Hamiltonian graph theory.
One solution
Another Example
Hamiltonian Graphs
Hamiltonian graph:
▪ Examples:
Semi-Hamiltonian Graphs
Semi-Hamiltonian graph:
Examples:
Travelling Salesman Problem
Solution: 𝑣0 − 𝑣1 − ⋯ − 𝑣𝑛 − 𝑣0
Travelling Salesman Problem: A fully-connected graph
Example:
A
9 12
7
E 9 B 10
13 5
8
6
D 11 C
Start from A
A → D → B → C → E → A (This is a loop)
However:
C → E → B → D → A → C (Total path length = 5 + 9 + 6 + 7 + 10 = 37)
Example of TSP for Optimal Design
Is this a (semi)-Hamiltonian graph ?
Knight’s Tour Game
Can the knight visit every block, once and once
only, and finally return to the starting point?
Eulerian Graph:
Hamiltonian Graph:
non-simple graph
double connection
Degrees
In-degree: 𝑑𝑖𝑛
Out-degree: 𝑑𝑜𝑢𝑡
Total degree: 𝑑 = 𝑑𝑖𝑛 + 𝑑𝑜𝑢𝑡
Balanced: 𝑑𝑖𝑛 = 𝑑𝑜𝑢𝑡
➢ Directed path
➢ Directed cycle (loop)
➢ Directed tree
➢ Directed Eulerian graph
➢ Directed Hamiltonian graph
Connectivity
A digraph is (weakly) connected if its underlying graph is
connected.
A digraph is strongly connected if there is a directed path
from any node to any other node.
1
4
connected but not strongly connected
2 3
1
4
strongly connected
2 3
Adjacency Matrix
1 0 1 0 0
4 0 0 1 0
Ad = [aij ] = (asymmetric)
2 3 1 1 0 0
0 0 1 0
aij -- from i to j
Underlying network
A is not well-defined
due to multiple edges
Incidence Matrix