2025/6/17 CS201 1
, What is a graph?
• Graphs represent the relationships among data
items
• A graph G consists of
– a set V of nodes (vertices)
– a set E of edges: each edge connects two nodes
• Each node represents an item
• Each edge represents the relationship between
two items
node
edge
2025/6/17 CS201 2
, Examples of graphs
Molecular Structure Computer Network
H Server 1 Terminal 1
H C H
Terminal 2
H Server 2
Other examples: electrical and communication networks,
airline routes, flow chart, graphs for planning projects
2025/6/17 CS201 3
, Formal Definition of graph
• The set of nodes is denoted as V
• For any nodes u and v, if u and v are
connected by an edge, such edge is denoted
as (u, v) v
(u, v)
u
• The set of edges is denoted as E
• A graph G is defined as a pair (V, E)
2025/6/17 CS201 4