Lec1 Graph
Lec1 Graph
Applications
Lecture 1: Introduction to Graph
2
Course Overview: First part
Review previous topics on Data Structures and Algorithms/Discrete Math
3
Course Overview 2: Second part
Advanced topics in Graph: Maximum Flow and Graph Matching, Tree, TSP
4
Course Overview 3: Third part
More advanced topics on Graph:
1. Random Walk
2. Spectral Theory on Graph
3. Graph Neural Network
5
Timeline
Part 1: Basic Graph Algs Part 2: More Graph Algs Part 3: Advanced Topics
Grading Policy:
6
Course overview: Graph Theory
+ The first part + second part: An advanced Data Structures and Algorithms course
- Understanding definitions and its applications
- Solve several problems
- Coding examples
- *Require* discrete math skills
7
Course overview: Graph Theory
+ The third part: 4th year course, related Machine Learning and Data Mining
- Get familiar with python and its libraries on graph analysis: networkx, pytorch-geometric
- Deep learning on graph
- Read papers/writing reports
9
Course overview
Lecturer: Ta Viet Cuong, Ph. D (email: cuongtv@vnu.edu.vn)
10
Research Directions on Graph
Focus on: Machine Learning/Deep Learning for Graph-based Data. Why?
Others:
12
Research at HMI lab
Engineer:
13
Research at HMI lab
Engineer: Theory:
14
Introduction to Graph
I. Course Overview
II. Graph definitions
a. Graph elements
b. Graph type
III. Graph Representation
IV. Graph Applications
V. Homework
15
Graph Definition
A graph represent G = <V, E> with:
V= - N vertices
E= - M edges
Each represents a connection
between 2 vertices
V = {A, B, C, D, E}
17
Graph Terminology
V - Vertices:
E - Edges:
18
Graph Type: Undirected vs Directed
Based on the properties of edges: Is (A, B) the same as (B, A) ?
19
Graph Type: no-weight vs weighted
Based on attributes of edge: it is associated with a number
20
Other types of graph
22
Other types of edges
From theory aspect, there are other properties of E which could raise major issues:
Multiple Edges
Fig 5. Special edge types
23
Introduction to Graph
I. Course Overview
II. Graph definitions
a. Graph elements
b. Graph type
III. Graph Representation
IV. Graph Applications
V. Homework
24
Adjacency Matrix
Let G = <V, E> with N vertices, M edges. Assume the vertices is 1, 2, .., N.
The adjacency matrix representation of G is a square NxN matrix A
25
Example 1
Example with V = {A, B, C, D, E} and self-loop edge
Quiz 2. Could you verify that the smallest eigenvalues of A is zero if G is connected?
26
Example 2
The matrix is not symmetric anymore:
27
Computational Analysis: Adjacency Matrix
Memory Complexity: O(NxN)
Time Complexity:
28
Adjacency List - Short version
Store the list of vertices could reach from a vertices A
Time Complexity:
30
Adjacency List - Full version
1. An array containing the graph’s vertices
32
Adjacency Matrix and Adjacency List
Undirected Graph
33
Adjacency Matrix and Adjacency List
Weighted version
34
Edges list
Intuition: the more we store, the more trouble when we need to updates
Time Complexity:
36
Introduction to Graph
I. Course Overview
II. Graph definitions
a. Graph elements
b. Graph type
III. Graph Representation
IV. Graph Applications
V. Homework
37
Graph Applications 1
Road networks: K-Connected roads, Shortest path/Fastest path, Planning/Routing
38
Graph Applications 2
Social Network applications (see Homework 2):
39
Graph Applications 3
Image analysis with graph
40
Homework 1:
Prove or disapprove following statements:
1. Given a connected, simple, undirected graph, we have:
41
Homework 2: Dynamic Social Graph
Given a undirected graph G = <V, E>.
- We define the L1(v) is the set of friends, L2(v) is the set of nodes can reach from v with two-steps propagation,
and not belong to L1(v) - friends of friends.
- We also define a closeness measure between two nodes u, v:
- G have dynamic edges, i.e edges are updated frequently including adding and deleting.
Tasks: With each v, we want to extract the first K - largest values d(u, v) with u in L2(v). How do you store G if:
a) G is a dense graph
b) G is a sparse graph
c) G is an “almost sparse graph”, a small amount of nodes (1-2%) have much bigger degrees than the others
42