SNA-Graph Essentials
SNA-Graph Essentials
SNA-Graph Essentials
MEDIA
MINING
Graph
Essentials
Bridges of Konigsberg
• A network is a graph.
– Elements of the network have meanings
• Network problems can usually be represented in
terms of graph theory
Twitter example:
• Given a piece of information, a
network of individuals, and the
cost to propagate information
among any connected pair, find
the minimum cost to disseminate
the information to all individuals.
Social Media Mining http://socialmediamining.info/ Measures
Graphand
Essentials
Metrics 44
Food Web
Citation Networks
Social Media Mining http://socialmediamining.info/ Measures
Graphand
Essentials
Metrics 66
Internet
• A social network
– A network where elements have a social structure
• A set of actors (such as individuals or organizations)
• A set of ties (connections between individuals)
Node
Edge
In Directed graphs:
– In-degrees is the number of edges pointing towards a node
(Degree sequence)
is the number of
nodes with degree 𝑑
Facebook
Degree Distribution
Social Media Mining http://socialmediamining.info/ Measures
Graphand
Essentials
Metrics 20
20
Subgraph
• is a subgraph of
5
6 4 5
3 1
1
3 2
2
• Adjacency Matrix
• Adjacency List
• Edge List
Social Media Mining http://socialmediamining.info/ Measures
Graphand
Essentials
Metrics 22
22
Graph Representation
• Null, Empty,
Directed/Undirected/Mixed,
Simple/Multigraph, Weighted,
Signed Graph, Webgraph
Social Media Mining http://socialmediamining.info/ Measures
Graphand
Essentials
Metrics 27
27
Null Graph and Empty Graph
The adjacency
matrix for
undirected graphs is
symmetric (𝑨 = 𝑨𝑻 )
w ij or w(i, j), w R
Aij
0, There is no edge between vi and v j
Bow-tie structure
Government Agencies
Broder et al –
200 million pages, 1.5 billion links
Social Media Mining http://socialmediamining.info/ Measures
Graphand
Essentials
Metrics 34
34
Connectivity in Graphs
• Adjacent nodes/Edges,
Walk/Path/Trail/Tour/Cycle
• Representing a walk:
– A sequence of edges: 𝑒1, 𝑒2, … , 𝑒𝑛
– A sequence of nodes: 𝑣1, 𝑣2, … , 𝑣𝑛
• Length of walk:
the number of visited edges
Length of walk= 8
Length of path= 4
Eulerian Tour
• All edges are traversed only once
– Konigsberg bridges
Hamiltonian Cycle
• A cycle that visits all nodes
3 components 3 Strongly-connected
components
• A set of disconnected
trees is called a forest
Regular graph
With 𝑘 = 3
Dijkstra’s Algorithm
– Designed for weighted graphs with non-negative edges
– It finds shortest paths that start from a provided node 𝑠
to all other nodes
– It finds both shortest paths and their respective lengths
1. Initiation:
– Assign zero to the source node and infinity to all other nodes
– Mark all nodes as unvisited
– Set the source node as current
2. For the current node, consider all of its unvisited Tentative distance =
neighbors and calculate their tentative distances current distance +
– If tentative distance is smaller than neighbor’s distance, then edge weight
Neighbor’s distance = tentative distance
3. After considering all of the neighbors of the current A visited node will
node, mark the current node as visited and remove it
from the unvisited set never be checked
again and its
distance recorded
4. If the destination node has been marked visited or if now is final and
the smallest tentative distance among the nodes in minimal
the unvisited set is infinity, then stop
• 19
– 11+8 from s, or
– 4+15 to t
Flow Quantity: 1
1. Set 𝑉’ = 𝑉 ∪ 𝑠 ∪ 𝑡
2. Connect all nodes in 𝑉𝐿
to 𝑠 and all nodes in 𝑉𝑅
to 𝑡
3. Set 𝑐(𝑢, 𝑣) = 1, for all
edges in 𝐸’
Why?