Most of contents are provided by the website Graph Essentials TJTSD66: Advanced Topics in Social Media.

Slides:



Advertisements
Similar presentations
CSE 211 Discrete Mathematics
Advertisements

Lecture 15. Graph Algorithms
22C:19 Discrete Math Graphs Fall 2014 Sukumar Ghosh.
Topological Sort Topological sort is the list of vertices in the reverse order of their finishing times (post-order) of the depth-first search. Topological.
CS 206 Introduction to Computer Science II 03 / 27 / 2009 Instructor: Michael Eckmann.
Graphs Chapter 12. Chapter Objectives  To become familiar with graph terminology and the different types of graphs  To study a Graph ADT and different.
Graphs Chapter 20 Data Structures and Problem Solving with C++: Walls and Mirrors, Carrano and Henry, © 2013.
Chapter 8, Part I Graph Algorithms.
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Chapter 27 Graph Applications.
Introduction This chapter explores graphs and their applications in computer science This chapter explores graphs and their applications in computer science.
© 2006 Pearson Addison-Wesley. All rights reserved14 A-1 Chapter 14 excerpts Graphs (breadth-first-search)
Data Structures Using C++
Edited by Malak Abdullah Jordan University of Science and Technology Data Structures Using C++ 2E Chapter 12 Graphs.
Data Structure and Algorithms (BCS 1223) GRAPH. Introduction of Graph A graph G consists of two things: 1.A set V of elements called nodes(or points or.
CS171 Introduction to Computer Science II Graphs Strike Back.
Midwestern State University Department of Computer Science Dr. Ranette Halverson CMPS 2433 CHAPTER 4 - PART 2 GRAPHS 1.
C++ Programming: Program Design Including Data Structures, Third Edition Chapter 21: Graphs.
Graph & BFS.
CS 311 Graph Algorithms. Definitions A Graph G = (V, E) where V is a set of vertices and E is a set of edges, An edge is a pair (u,v) where u,v  V. If.
Graphs CS-240/341. Uses for Graphs computer networks and routing airline flights geographic maps course prerequisite structures tasks for completing a.
Graph COMP171 Fall Graph / Slide 2 Graphs * Extremely useful tool in modeling problems * Consist of: n Vertices n Edges D E A C F B Vertex Edge.
Graph & BFS Lecture 22 COMP171 Fall Graph & BFS / Slide 2 Graphs * Extremely useful tool in modeling problems * Consist of: n Vertices n Edges D.
1 Data Structures and Algorithms Graphs I: Representation and Search Gal A. Kaminka Computer Science Department.
Graphs Chapter 12. Chapter 12: Graphs2 Chapter Objectives To become familiar with graph terminology and the different types of graphs To study a Graph.
Spring 2010CS 2251 Graphs Chapter 10. Spring 2010CS 2252 Chapter Objectives To become familiar with graph terminology and the different types of graphs.
Graphs & Graph Algorithms 2 Nelson Padua-Perez Bill Pugh Department of Computer Science University of Maryland, College Park.
CS 206 Introduction to Computer Science II 11 / 05 / 2008 Instructor: Michael Eckmann.
© 2006 Pearson Addison-Wesley. All rights reserved14 B-1 Chapter 14 (continued) Graphs.
Fall 2007CS 2251 Graphs Chapter 12. Fall 2007CS 2252 Chapter Objectives To become familiar with graph terminology and the different types of graphs To.
Graphs Chapter 20 Data Structures and Problem Solving with C++: Walls and Mirrors, Frank Carrano, © 2012.
Graphs & Graph Algorithms 2 Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Graph Essentials Social Media Mining. 2 Measures and Metrics 2 Social Media Mining Graph Essentials Networks A network is a graph. – Elements of the network.
C o n f i d e n t i a l HOME NEXT Subject Name: Data Structure Using C Unit Title: Graphs.
Social Media Mining Graph Essentials.
IS 2610: Data Structures Graph April 5, 2004.
Week -7-8 Topic - Graph Algorithms CSE – 5311 Prepared by:- Sushruth Puttaswamy Lekhendro Lisham.
Chapter 9 – Graphs A graph G=(V,E) – vertices and edges
Graph Dr. Bernard Chen Ph.D. University of Central Arkansas.
Chapter 2 Graph Algorithms.
Fundamentals, Terminology, Traversal, Algorithms Graph Algorithms Telerik Algo Academy
Chapter 14 Graphs. © 2004 Pearson Addison-Wesley. All rights reserved Terminology G = {V, E} A graph G consists of two sets –A set V of vertices,
COSC 2007 Data Structures II Chapter 14 Graphs III.
Representing and Using Graphs
Graphs. Definitions A graph is two sets. A graph is two sets. –A set of nodes or vertices V –A set of edges E Edges connect nodes. Edges connect nodes.
Runtime O(VE), for +/- edges, Detects existence of neg. loops
Graphs A ‘Graph’ is a diagram that shows how things are connected together. It makes no attempt to draw actual paths or routes and scale is generally inconsequential.
Graphs. Graphs Similar to the graphs you’ve known since the 5 th grade: line graphs, bar graphs, etc., but more general. Those mathematical graphs are.
Graphs A graphs is an abstract representation of a set of objects, called vertices or nodes, where some pairs of the objects are connected by links, called.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Ver Chapter 13: Graphs Data Abstraction & Problem Solving with C++
Graphs Part II Lecture 7. Lecture Objectives  Topological Sort  Spanning Tree  Minimum Spanning Tree  Shortest Path.
1 Directed Graphs Chapter 8. 2 Objectives You will be able to: Say what a directed graph is. Describe two ways to represent a directed graph: Adjacency.
COSC 2007 Data Structures II
Graphs Chapter 12. Chapter 12: Graphs2 Chapter Objectives To become familiar with graph terminology and the different types of graphs To study a Graph.
Graphs Slide credits:  K. Wayne, Princeton U.  C. E. Leiserson and E. Demaine, MIT  K. Birman, Cornell U.
© 2006 Pearson Addison-Wesley. All rights reserved 14 A-1 Chapter 14 Graphs.
– Graphs 1 Graph Categories Strong Components Example of Digraph
Discrete Structures CISC 2315 FALL 2010 Graphs & Trees.
Graphs Upon completion you will be able to:
Chapter 20: Graphs. Objectives In this chapter, you will: – Learn about graphs – Become familiar with the basic terminology of graph theory – Discover.
Chapter 05 Introduction to Graph And Search Algorithms.
Data Structures and Algorithm Analysis Graph Algorithms Lecturer: Jing Liu Homepage:
Main Index Contents 11 Main Index Contents Graph Categories Graph Categories Example of Digraph Example of Digraph Connectedness of Digraph Connectedness.
© 2006 Pearson Addison-Wesley. All rights reserved14 B-1 Chapter 14 (continued) Graphs.
Graphs Representation, BFS, DFS
Graph theory Definitions Trees, cycles, directed graphs.
I206: Lecture 15: Graphs Marti Hearst Spring 2012.
Graphs Chapter 13.
Chapter 11 Graphs.
Chapter 14 Graphs © 2011 Pearson Addison-Wesley. All rights reserved.
INTRODUCTION A graph G=(V,E) consists of a finite non empty set of vertices V , and a finite set of edges E which connect pairs of vertices .
Presentation transcript:

Most of contents are provided by the website Graph Essentials TJTSD66: Advanced Topics in Social Media Dr. WANG, CS & IS, JYU Homepage: (Social Media Mining)

2 Social Media Mining Graph Essentials Slide 2 of 65 Networks 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.

3 Social Media Mining Graph Essentials Slide 3 of 65 Internet

4 Social Media Mining Graph Essentials Slide 4 of 65 Social Networks (Users tweeting “#PDF2010” )

5 Social Media Mining Graph Essentials Slide 5 of 65 Social Networks and Social Network Analysis 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) Social networks examples: – your family network, your friend network, your colleagues,etc. To analyze these networks we can use Social Network Analysis (SNA) Social Network Analysis is an interdisciplinary field from social sciences, statistics, graph theory, complex networks, and now computer science

6 Social Media Mining Graph Essentials Slide 6 of 65 Graph Basics

7 Social Media Mining Graph Essentials Slide 7 of 65 Nodes and Edges A network is a graph, or a collection of points connected by lines Points are referred to as nodes, actors, or vertices (plural of vertex) Connections are referred to as edges or ties Node Edge

8 Social Media Mining Graph Essentials Slide 8 of 65 Nodes or Actors

9 Social Media Mining Graph Essentials Slide 9 of 65 Edges

10 Social Media Mining Graph Essentials Slide 10 of 65 Directed Edges and Directed Graphs

11 Social Media Mining Graph Essentials Slide 11 of 65 Neighborhood and Degree

12 Social Media Mining Graph Essentials Slide 12 of 65 Degree and Degree Distribution

13 Social Media Mining Graph Essentials Slide 13 of 65 Degree Distribution Degree distribution histogram – The x-axis represents the degree and the y- axis represents the number of nodes (frequency) having that degree

14 Social Media Mining Graph Essentials Slide 14 of 65 Subgraph

15 Social Media Mining Graph Essentials Slide 15 of 65 Adjacency Matrix Adjacency List Edge List Graph Representation

16 Social Media Mining Graph Essentials Slide 16 of 65 Graph Representation Graph representation is straightforward and intuitive, but it cannot be effectively manipulated using mathematical and computational tools We are seeking representations that can store these two sets in a way such that – Does not lose information – Can be manipulated easily by computers – Can have mathematical methods applied easily

17 Social Media Mining Graph Essentials Slide 17 of 65 Adjacency Matrix A Social media networks have very sparse Adjacency matrices Social media networks have very sparse Adjacency matrices Diagonal Entries are self-links or loops

18 Social Media Mining Graph Essentials Slide 18 of 65 Adjacency List In an adjacency list for every node, we maintain a list of all the nodes that it is connected to The list is usually sorted based on the node order or other preferences

19 Social Media Mining Graph Essentials Slide 19 of 65 Edge List or

20 Social Media Mining Graph Essentials Slide 20 of 65 Null, Empty, Directed/Undirected/Mixed, Simple/Multigraph, Weighted, Webgraph, Signed Graph Types of Graphs

21 Social Media Mining Graph Essentials Slide 21 of 65 Null Graph and Empty Graph

22 Social Media Mining Graph Essentials Slide 22 of 65 Directed/Undirected/Mixed Graphs

23 Social Media Mining Graph Essentials Slide 23 of 65 Simple Graphs and Multigraphs Simple graphs are graphs where only a single edge can be between any pair of nodes Multigraphs are graphs where you can have multiple edges between two nodes and loops (self- links) The adjacency matrix for multigraphs can include numbers larger than one, indicating multiple edges between nodes Simple graph Multigraph

24 Social Media Mining Graph Essentials Slide 24 of 65 Weighted Graph A weighted graph is one where edges are associated with weights – For example, a graph could represent a map Nodes: cities Edges: routes between them Weights: the distances between these cities

25 Social Media Mining Graph Essentials Slide 25 of 65 Webgraph A webgraph is a way of representing how internet sites are connected on the web In general, a web graph is a directed multigraph Nodes represent sites and edges represent links between sites. Two sites can have multiple links pointing to each other and can have loops (links pointing to themselves)

26 Social Media Mining Graph Essentials Slide 26 of 65 Webgraph: Government Agencies

27 Social Media Mining Graph Essentials Slide 27 of 65 Signed Graph When weights are binary (0/1, -1/1, +/-) we have a signed graph It is used to represent friends or foes It is also used to represent social status

28 Social Media Mining Graph Essentials Slide 28 of 65 Adjacent nodes/Edges, Walk/Path/Trail/Tour/Cycle, Connectivity in Graphs

29 Social Media Mining Graph Essentials Slide 29 of 65 Adjacent nodes and Incident Edges

30 Social Media Mining Graph Essentials Slide 30 of 65 Walk, Path, Trail, Tour, and Cycle Length of walk= 8

31 Social Media Mining Graph Essentials Slide 31 of 65 Trail A trail is a walk where no edge is visited more than once and all walk edges are distinct A closed trail (one that ends where it starts) is called a tour or circuit

32 Social Media Mining Graph Essentials Slide 32 of 65 Path A walk where nodes and edges are distinct is called a path and a closed path is called a cycle The length of a path or cycle is the number of edges visited in the path or cycle Length of path= 4 go to 40

33 Social Media Mining Graph Essentials Slide 33 of 65 Random walk

34 Social Media Mining Graph Essentials Slide 34 of 65 Connectivity

35 Social Media Mining Graph Essentials Slide 35 of 65 Connectivity: Example

36 Social Media Mining Graph Essentials Slide 36 of 65 Component In an undirected graph – Component: A connected subgraph, i.e., there is a path between every pair of nodes inside the component In directed graphs – Strongly connected component: A subgraph which is strongly connected. – Weakly connected component: A subgraph which is weakly connected

37 Social Media Mining Graph Essentials Slide 37 of 65 Component Examples: 3 components 3 Strongly-connected components 3 Strongly-connected components

38 Social Media Mining Graph Essentials Slide 38 of 65 Shortest Path

39 Social Media Mining Graph Essentials Slide 39 of 65 Diameter

40 Social Media Mining Graph Essentials Slide 40 of 65 Special Graphs: Trees and Forests A forest containing 3 trees

41 Social Media Mining Graph Essentials Slide 41 of 65 Special Subgraphs

42 Social Media Mining Graph Essentials Slide 42 of 65 Spanning Trees For any connected graph, the spanning tree is a subgraph and a tree that includes all the nodes of the graph There may exist multiple spanning trees for a graph. For a weighted graph and one of its spanning tree, the weight of that spanning tree is the summation of the edge weights in the tree. Among the many spanning trees found for a weighted graph, the one with the minimum weight is called the minimum spanning tree (MST)

43 Social Media Mining Graph Essentials Slide 43 of 65 Prim’s Algorithm Execution Example

44 Social Media Mining Graph Essentials Slide 44 of 65 Prim’s Algorithm: Finding Minimum Spanning Tree It finds minimal spanning trees in a weighted graph – It starts by selecting a random node and adding it to the spanning tree. – It then grows the spanning tree by selecting edges which have one endpoint in the existing spanning tree and one endpoint among the nodes that are not selected yet. Among the possible edges, the one with the minimum weight is added to the set (along with its end-point). – This process is iterated until the graph is fully spanned

45 Social Media Mining Graph Essentials Slide 45 of 65 Steiner Trees

46 Social Media Mining Graph Essentials Slide 46 of 65 Complete Graphs

47 Social Media Mining Graph Essentials Slide 47 of 65 Planar Graphs A graph that can be drawn in such a way that no two edges cross each other (other than the endpoints) is called planar Planar GraphNon-planar Graph

48 Social Media Mining Graph Essentials Slide 48 of 65 Bipartite Graphs

49 Social Media Mining Graph Essentials Slide 49 of 65 Affiliation Networks An affiliation network is a bipartite graph. If an individual is associated with an affiliation, an edge connects the corresponding nodes.

50 Social Media Mining Graph Essentials Slide 50 of 65 Regular Graphs

51 Social Media Mining Graph Essentials Slide 51 of 65 Bridges (cut-edges) Bridges are edges whose removal will increase the number of connected components

52 Social Media Mining Graph Essentials Slide 52 of 65 Bridge Detection

53 Social Media Mining Graph Essentials Slide 53 of 65 Graph/Network Traversal Algorithms

54 Social Media Mining Graph Essentials Slide 54 of 65 Graph/Tree Traversal Consider a social media site that has many users and we are interested in surveying the site and computing the average age of its users. The usual technique is to start from one user and employ some traversal technique to browse his friends and then these friends’ friends and so on. The traversal technique guarantees that 1. All users are visited; and 2. No user is visited more than once. There are two main techniques: – Depth-First Search (DFS) – Breadth-First Search (BFS)

55 Social Media Mining Graph Essentials Slide 55 of 65 Depth-First Search (DFS)

56 Social Media Mining Graph Essentials Slide 56 of 65 DFS Algorithm

57 Social Media Mining Graph Essentials Slide 57 of 65 Depth-First Search (DFS): An Example

58 Social Media Mining Graph Essentials Slide 58 of 65 Breadth-First Search (BFS) BFS starts from a node, visits all its immediate neighbors first, and then moves to the second level by traversing their neighbors. The algorithm can be used both for trees and graphs – The algorithm can be implemented using a queue structure

59 Social Media Mining Graph Essentials Slide 59 of 65 BFS Algorithm

60 Social Media Mining Graph Essentials Slide 60 of 65 Breadth-First Search (BFS)

61 Social Media Mining Graph Essentials Slide 61 of 65 Shortest Path When a graph is connected, there is a chance that multiple paths exist between any pair of nodes – In many scenarios, we want the shortest path between two nodes in a graph Dijkstra’s Algorithm – It is designed for weighted graphs with non-negative edges – It finds shortest paths that start from a provided node s to all other nodes – It finds both shortest paths and their respective lengths

62 Social Media Mining Graph Essentials Slide 62 of 65 Dijkstra’s Algorithm Execution Example

63 Social Media Mining Graph Essentials Slide 63 of 65 Dijkstra’s Algorithm: Finding the shortest path 1.Initiation: – Assign zero to the source node and infinity to all other nodes – Mark all nodes unvisited – Set the source node as current 2.For the current node, consider all of its unvisited neighbors and calculate their tentative distances – If tentative distance (current node’s distance + edge weight) is smaller than neighbor’s distance, then Neighbor’s distance = tentative distance 3.After considering all of the neighbors of the current node, mark the current node as visited and remove it from the unvisited set – A visited node will never be checked again and its distance recorded now is final and minimal 4.If the destination node has been marked visited or if the smallest tentative distance among the nodes in the unvisited set is infinity, then stop 5.Set the unvisited node marked with the smallest tentative distance as the next "current node" and go to step 2

64 Social Media Mining Graph Essentials Slide 64 of 65 Dijkstra’s Algorithm Dijkstra’s algorithm is source-dependent and finds the shortest paths between the source node and all other nodes. To generate all-pair shortest paths, one can run dijsktra’s algorithm n times or use other algorithms such as Floyd-Warshall algorithm. If we want to compute the shortest path from source v to destination d, we can stop the algorithm once the shortest path to the destination node has been determined

65 Social Media Mining Graph Essentials Slide 65 of 65 Any Question?