1 ELEC692 Fall 2004 Lecture 1b ELEC692 Lecture 1a Introduction to graph theory and algorithm.

Slides:



Advertisements
Similar presentations
CSE 211 Discrete Mathematics
Advertisements

Lecture 15. Graph Algorithms
Connectivity - Menger’s Theorem Graphs & Algorithms Lecture 3.
Chapter 9 Graphs.
Lecture 5 Graph Theory. Graphs Graphs are the most useful model with computer science such as logical design, formal languages, communication network,
2012: J Paul GibsonT&MSP: Mathematical FoundationsMAT7003/L2-GraphsAndTrees.1 MAT 7003 : Mathematical Foundations (for Software Engineering) J Paul Gibson,
22C:19 Discrete Math Graphs Fall 2014 Sukumar Ghosh.
CS 206 Introduction to Computer Science II 03 / 27 / 2009 Instructor: Michael Eckmann.
 Graph Graph  Types of Graphs Types of Graphs  Data Structures to Store Graphs Data Structures to Store Graphs  Graph Definitions Graph Definitions.
FUNDAMENTAL PROBLEMS AND ALGORITHMS Graph Theory and Combinational © Giovanni De Micheli Stanford University.
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.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2001 Lectures 3 Tuesday, 9/25/01 Graph Algorithms: Part 1 Shortest.
Lists A list is a finite, ordered sequence of data items. Two Implementations –Arrays –Linked Lists.
Graph Algorithms: Part 1
1 Intro. to Graph Theory BIO/CS 471 – Algorithms for bioinformatics Graph Theoretic Concepts and Algorithms for Bioinformatics.
1 Graph Introduction Definitions. 2 Definitions I zDirected Graph (or Di-Graph) is an ordered pair G=(V,E) such that yV is a finite, non-empty set (of.
CS 206 Introduction to Computer Science II 11 / 05 / 2008 Instructor: Michael Eckmann.
CS Data Structures Chapter 6 Graphs.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 10 Instructor: Paul Beame.
CS/ENGRD 2110 Object-Oriented Programming and Data Structures Fall 2014 Doug James Lecture 17: Graphs.
Discrete Mathematics Lecture 9 Alexander Bukharovich New York University.
22C:19 Discrete Math Graphs Spring 2014 Sukumar Ghosh.
Social Media Mining Graph Essentials.
GRAPHS Education is what remains after one has forgotten what one has learned in school. Albert Einstein Albert Einstein Smitha N Pai.
IS 2610: Data Structures Graph April 5, 2004.
Been-Chian Chien, Wei-Pang Yang, and Wen-Yang Lin 6-1 Chapter 6 Graphs Introduction to Data Structure CHAPTER 6 GRAPHS 6.1 The Graph Abstract Data Type.
Chapter 9 – Graphs A graph G=(V,E) – vertices and edges
Lecture 12-2: Introduction to Computer Algorithms beyond Search & Sort.
Graph Theoretic Concepts. What is a graph? A set of vertices (or nodes) linked by edges Mathematically, we often write G = (V,E)  V: set of vertices,
Chapter 2 Graph Algorithms.
1 CS104 : Discrete Structures Chapter V Graph Theory.
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.
Data Structures & Algorithms Graphs
Basic Notions on Graphs. The House-and-Utilities Problem.
1 12/2/2015 MATH 224 – Discrete Mathematics Formally a graph is just a collection of unordered or ordered pairs, where for example, if {a,b} G if a, b.
COSC 2007 Data Structures II Chapter 14 Graphs I.
1 Graphs Theory UNIT IV. 2Contents  Basic terminology,  Multi graphs and weighted graphs  Paths and circuits  Shortest path in weighted graph  Hamiltonian.
Introduction to Graph Theory
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Ver Chapter 13: Graphs Data Abstraction & Problem Solving with C++
GRAPHS. Graph Graph terminology: vertex, edge, adjacent, incident, degree, cycle, path, connected component, spanning tree Types of graphs: undirected,
© 2006 Pearson Addison-Wesley. All rights reserved 14 A-1 Chapter 14 Graphs.
Discrete Structures CISC 2315 FALL 2010 Graphs & Trees.
Graphs Upon completion you will be able to:
Introduction to Graph Theory By: Arun Kumar (Asst. Professor) (Asst. Professor)
Graph Concepts and Algorithms Using LEDA By Caroline Moore and Carmen Frerichs (252a-at and 252a-ao) each graph in the presentation was created using gw_basic_graph_algorithms.
Chapter 20: Graphs. Objectives In this chapter, you will: – Learn about graphs – Become familiar with the basic terminology of graph theory – Discover.
Graph Theory Graph Theory - History Leonhard Euler's paper on “Seven Bridges of Königsberg”, published in 1736.
Data Structures and Algorithm Analysis Graph Algorithms Lecturer: Jing Liu Homepage:
Chap 7 Graph Def 1: Simple graph G=(V,E) V : nonempty set of vertices E : set of unordered pairs of distinct elements of V called edges Def 2: Multigraph.
Lecture #13. Topics 1.The Graph Abstract Data Type. 2.Graph Representations. 3.Elementary Graph Operations.
1 Data Structures and Algorithms Graphs. 2 Graphs Basic Definitions Paths and Cycles Connectivity Other Properties Representation Examples of Graph Algorithms:
Leda Demos By: Kelley Louie Credits: definitions from Algorithms Lectures and Discrete Mathematics with Algorithms by Albertson and Hutchinson graphics.
Graphs Lecture 19 CS2110 – Spring 2013.
Basic Concepts Graphs For more notes and topics visit:
Graph theory Definitions Trees, cycles, directed graphs.
Modeling and Simulation NETW 707
Graphs Chapter 13.
Graphs All tree structures are hierarchical. This means that each node can only have one parent node. Trees can be used to store data which has a definite.
What is a Graph? a b c d e V= {a,b,c,d,e} E= {(a,b),(a,c),(a,d),
Algorithms (2IL15) – Lecture 7
Chapter 24: Single-Source Shortest Paths
Text Book: Introduction to algorithms By C L R S
Graphs G = (V, E) V are the vertices; E are the edges.
Chapter 24: Single-Source Shortest Paths
Chapter 14 Graphs © 2011 Pearson Addison-Wesley. All rights reserved.
Introduction to Graph Theory
HW 3 (Due Wednesday Feb 6) Create slide(s) for your 1 minute presentation on a graph theory application. Make sure your slide(s) include (1) Define the.
GRAPHS.
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 .
More Graphs Lecture 19 CS2110 – Fall 2009.
Presentation transcript:

1 ELEC692 Fall 2004 Lecture 1b ELEC692 Lecture 1a Introduction to graph theory and algorithm

2 ELEC692 Fall 2004 Lecture 1b Graphs  A graph G(V,E) is a pair (V,E) where V is a set of vertices and E is a binary relation on V which is called the edges of the graph.  In a directed graph, the edges are ordered pairs or vertices; in an undirected graph, the edges are unordered pairs.  Degree of a vertex (node) = number of edges incident to it.  Hypergraph - extension of a graph where edges may be incident to any number of vertices, Undirected graphdirected graphHypergraph

3 ELEC692 Fall 2004 Lecture 1b Undirected Graphs (I)  A vertex is adjacent to another if there is an edge incident to both of them.  Loop-an edge with two identical end-points  A graph is simple if it has no loop and two edges link the same vertex pair. Otherwise it is called multi-graph.  A walk is an alternating sequence of vertices and edges and a trail is a walk with distinct edges and a path is a trail with distinct vertices.  A cycle is a closed walk with distinct vertices.  A graph is connected if all vertex pairs are joined by a path.  A graph with no cycles is called an acyclic graph. ab cd loop a is adjacent to b The graph is simple if the loop is removed. (a,1,b,2,d,5,a,1) is a walk. (a,1,b,2,d,5,a,4) is a trail. (a,1,b,2,d,3,c,4) is a path. (a,1,b,2,d,5,a) is a cycle. The graph is a connected. It is not an acyclic graph.

4 ELEC692 Fall 2004 Lecture 1b Undirected Graphs (II)  A tree is a connected acyclic graph. A rooted tree is a tree with a distinct vertex called root.  Vertices of a tree are called nodes. Nodes that are only connected to one vertex are called leaves.  A cutset is a minimal set of edges whose removal from the graph makes it disconnected. Similarly a vertex separation set is a minimal set of vertex whose removal from the graph makes it disconnected.  A complete graph is one such that each vertex pair is joined by an edge. A complement of a graph G(V,E) is a graph with V and two vertices are adjacent iff they are not adjacent in G.  A bipartite graph is a graph where the vertex set can be partitioned into 2 subsets such that each edge has end-points in different subsets. ab cd 1 24 root leaves 1 ab cd A complete graph {1,4,6} is a cutset {a} is a vertex sep. set ab cd 24 56

5 ELEC692 Fall 2004 Lecture 1b Undirected Graphs (III)  A subgraph of a graph V(G,E) is a graph whose vertex and edge sets are contained in the vertex and edges set of G. Give a vertex set U contains in V, the subgraph induced by U is the maximal subgraph of G(V,E), whose edges have end-points in U.  A clique of a graph is a complete subgraph.  A clique is maximal when it is not contained in other clique.  A graph is planar if it has a diagram on a plane surface such that no two edges cross.  Two graphs are said to be isomorphic if there is a one-to-one correspondence between their vertex sets that preserves adjacency. maximal clique planar isomorphic

6 ELEC692 Fall 2004 Lecture 1b Directed Graph  For any directed edge (v i, v j ), vertex v j is called the head and v i is the tail.  The indegree of a vertex is the number of edges where it is the head, the outdegree the number of edges where it is the tail.  Directed acyclic graphs (DAGS) represent partially ordered sets. In a DAG, a vertex v j is called the successor (or descendant) of a vertex v i if v j is the head of a path whose tail is v i.  A polar dag is a graph having two distinguished vertices, a source and a sink and where all vertices are reachable from the source and where the sink are reachable from all vertices.  Directed and undirected graphs can be weighted. Weights can be associated with vertices and/or with edges.

7 ELEC692 Fall 2004 Lecture 1b Matrix Representation  Incidence matrix and adjacency matrix a b c d e a b c d e Incidence matrix Adjacency matrix

8 ELEC692 Fall 2004 Lecture 1b Graph optimization problems and algorithms - Shortest/Longest path  Model Directed graph G(V,E) with N vertices Weights on each edge A source vertex  Single source shortest path problem find shortest path from the source to any vertex Inconsistent problem:  negative-weighted cycles  Bellman’s equations:path weight to a vertex in terms of the path weight to its direct predecessors:

9 ELEC692 Fall 2004 Lecture 1b Shortest Path Problem  Acyclic graphs: Topological sort O(n 2 ),  All positive weights - Dikstra’s algorithm (greedy) Complexity = O(|E| + |V| log |V|) Dijkstra (G(V,E,W)) { s 0 = 0; all other s i = infinity for (i= 1 to N) s i = w 0,i ; repeat { select unmarked v q s.t. s q is minimal; mark v q ; foreach (unmarked vertex v i ) s i = min{s i,(s q + w q,i )} } until (all vertices are marked) }

10 ELEC692 Fall 2004 Lecture 1b Example- Dikstra’s algorithm 0 u x y s u x y s v v v 0 u x y s v 0 u x y s v 0 u x y s v 0 u x y s

11 ELEC692 Fall 2004 Lecture 1b Shortest Path Problem  Graph has cycles and sign of weights is not restricted.  Bellman-Ford algorithm - solve Bellman’s equation by relaxation. Complexity O(|V||E|) < O(n 3 ) Bellman_ford (G(V,E,W)) { s 0 1 = 0; for (i= 1 to N) s i 1 = w 0,i ; for( j= 1 to N) for (i=1 to N) } if (s i j+1 = = s i j for all i } return (TRUE); } return (FALSE) }

12 ELEC692 Fall 2004 Lecture 1b Lonest Path Problem  Use shortest path algorithms: by reversing signs on weights  Modify algorithms: by changing min with max  Remarks: Dijkstra’s algorithm is not relevant Inconsistent problem  positive-weighted cycles

13 ELEC692 Fall 2004 Lecture 1b Example - Bellman-Ford Iteration 0: l 0 = 0; l 1 = -3; l 2 =-1; l 3 = Iteration 1: l 0 = 0; l 1 = -3; l 2 =-2; l 3 =-5 Iteration 2: l 0 = 0; l 1 = -3; l 2 =-2; l 3 =-6 Iteration 3: l 0 = 0; l 1 = -3; l 2 =-2; l 3 =-6