0% found this document useful (0 votes)
13 views26 pages

02 GraphTheory

The document provides an overview of graph theory, covering essential concepts such as nodes, edges, adjacency matrices, and different types of graphs (undirected, directed, and weighted). It discusses key metrics including node degree, paths, distance, and connectedness, along with methods for calculating average node degree and characteristic path length. The document also introduces the small-world phenomenon and the concept of giant components in graphs.

Uploaded by

Husein Yusuf
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views26 pages

02 GraphTheory

The document provides an overview of graph theory, covering essential concepts such as nodes, edges, adjacency matrices, and different types of graphs (undirected, directed, and weighted). It discusses key metrics including node degree, paths, distance, and connectedness, along with methods for calculating average node degree and characteristic path length. The document also introduces the small-world phenomenon and the concept of giant components in graphs.

Uploaded by

Husein Yusuf
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 26

Graph Theory Essentials

OUTLINES
• Graph Theory & Metrics
• Basics
• Node degree
• Paths & distance
• Components
Introduction
Graphs: Nodes and Edges.
• A graph is a way of specifying relationships among a
collection of items.
• A graph consists of a set of objects, called nodes, with
certain pairs of these objects connected by links called
edges.
• We say that two nodes are neighbors if they are connected
by an edge.
• with little circles representing the nodes, and a line
connecting each pair of nodes that are linked by an edge.
GRAPH THEORY BASICS

o Graph,
o Node
o Edge
o Adjacency Matrix
o Directed, Undirected and Weighted graph

***CS7280 / www.networksciencebook.com
Undirected, directed, weighted
graphs
Graph adjacency matrix

http://sourcecodemania.com/wp-content/uploads/2012/06/adjacency-matrix-of-graph.jpg
Graph adjacency matrix
(cont’)
• Many network properties can be
formulated as properties of the
adjacency matrix
– See “algebraic graph theory”

• For instance:
– A directed network is acyclic if and only
if all eigenvalues of the adjacency
matrix are equal to 0
• Proof?
Review: Undirected/Directed
A A

E B E B

D C D C

• Edges: defined by 2 vertices v and u


• Undirected: unordered (v, u)
• Directed: ordered (v, u)
Weighted Graphs
A F
0.1 0.3 0.1 0.3

E B I G
0.2 0.2
0.4 0.2 0.4 0.2
D C J H

• Weight for each edge e = (v,u)


w(A,B) = 0.3
w(E,D) = 0.4
w(I,J) = 0.4
w(G,F) = 0
Node degree, In- and Out-degree, Degree distribution, average degree,
connectance, sparse, dense

NODE DEGREE
Review: Node Degree
• Dfn: The node degree is the
number of neighbors a node has.
|N(v)| deg=3
A

• w.r.t. adjacency matrix: E B

adjacency A B C D E D C
matrix value
A 0 1 0 0 1

k v   av , u B 1
C 0
0
1
1
0
0
0
0
1
u V D 0 0 0 0 1
pick
row v E 1 0 1 1 0
Directed: In- & Out-Degree
A

• Out-degree: kv  av ,u E B
u V

D C
• In-degree: kv  au ,v
u V
column v, not row
A B C D E
A 0 1 0 0 1
B 0 0 0 0 0
C 0 1 0 0 1
D 0 0 0 0 0
E 0 0 0 1 0
Degree Distribution

• Plot node degrees of every node


• Statistics: max, min, mean, variance,
skewness, kurtosis
• Useful: classifying graphs
INDIVIDUAL EXERCISE:

Find the average node degree of


these two graphs.
A

E B

D C
More Degree Metrics
# edges
• Average node degree: k  2 E
~
V # vertices
~
• Connectance:   k scale by
V-1 network size

– Intuition: How connected is it?


– Sparse graphs: V  ,   0
– Dense graphs: V  ,   C positive
constant
Paths, cycles, distance, breadth-first search, small world phenomenon,
characteristic path length, graph efficiency

PATHS AND DISTANCE


Review: Paths & Cycles
• Dfn: A path is a sequence of nodes
where pairs of consecutive nodes are
connected by an edge.
• Directed graph: direction matters!
• Dfn: A cycle is a path where the start
node is also the end node A

E B

Paths? Cycles? D C
Review: Distance
• Dfn: The distance dv,u between 2 nodes
in a graph = length of the shortest path
linking the 2 nodes
• Note: Need to find shortest path!

E B

D C
How would you calculate the
average distance from a node?
Breadth-First Search (BFS)
• Explore first-neighbors
• Explore neighbors’ neighbors
• Keep track of:
– nodes to explore (queue)
A
– visited nodes (set)
E B

D C
Small-world Phenomenon
• For 2 random people: path
distance?
• Millgram 1967 & following:
– 296 “starters” forward a letter to a
person through friends
– 64 completed chains
“six degrees”
Reasonable, unproven
Distance-based Metrics
• The characteristic path length is
the average shortest path length
(average distance).
1 distance from v to u
L
V(V  1)
d
v ,u V ,v u
v ,u

# possible node pairs

• Graph efficiency measures how


easily information
1 is transferred.
1
E 
V (V  1) v ,u V ,v u d v ,u
Connectedness, component, giant component

COMPONENTS
Review: Connectedness
Not edge!
• Dfn: A graph (or subgraph) is
connected if there is a path between
each pair of nodes.
• If no path, this is disconnected.
Components
• Dfn: a connected component is a
subset S of nodes where:
1. Every node in S has a path to every
other
S comp {v  S | u  S , path (u , v)}
2. S is not part of a larger subset S’
where property #1 holds
Giant Components
• A giant component: “connected
component that contains a
significant fraction of all the nodes”
• Ex: Real-world
• Ex: Random graphs (Erdos-Renyi
model – more later)
INDIVIDUAL EXERCISE:

Find the characteristic path


length and efficiency of this graph.
A

E B

D C

You might also like