1 / 12

GRAPHS AND GRAPH TRAVERSALS 9/26/2000

COMP 6/4030 ALGORITHMS. GRAPHS AND GRAPH TRAVERSALS 9/26/2000. Graphs - Definitions. Graph is a set of vertices (nodes) and edges where edges connect certain vertices Undirected graph : no direction of edges Directed graph (di-graph): edges are directed from one vertex to another

liza
Download Presentation

GRAPHS AND GRAPH TRAVERSALS 9/26/2000

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. COMP 6/4030 ALGORITHMS GRAPHS AND GRAPH TRAVERSALS9/26/2000

  2. Graphs - Definitions • Graph is a set of vertices (nodes) and edges where edges connect certain vertices • Undirected graph: no direction of edges • Directed graph (di-graph): edges are directed from one vertex to another • NOTE: a graph is defined by an binary relation upon the set of vertices V: • If node v and w are connected, then they are related as vRw. For di-graphs the binary relationship is ordered.

  3. SxS aRb R Graphs - as Relationships • RELATION: • Two members a,b of a set S either satisfy a certain relationship R or not. If satisfy, we write aRb. • NOTE: aRb defines a subset of all pairs (a,b). • Example: • ‘larger’: 4<5 True: 4R5 • 3<2 False

  4. Relationships • Example: Equivalence relation • A relationship with the properties below (=) • Reflective: sRs is True • Symmetric: If sRt true then tRs also True • Transitive: If sRt and tRu then sRt. • Note: The equivalence relationship R partitions S in to disjunct subsets Si

  5. Introduction to Graphs • Approaches to graphs: • Discrete math<------> Continuous math • Combinatorics Calculus from 17th century, • Graph theory Newton, Leibnitz,… • Digital computers Limitations of equations • Dilemmas: • Are natural processes discrete or continuous? • Is continuity is a mathematical abstraction?

  6. Graphs - Introduction • Graphs as Networks <---> Neural Networks • Low-dimensional High dimensional • ‘Few’ nodes (100, 1000) Billions of nodes • Firm math foundations Empirical: mostly • How to link mathematical rigor and high dimensionality?? • ===> Random Graphs are mathematically solid and can handle high-dimensional issues

  7. Graphs -Examples • Traffic routes: airlines • Flowcharts • Proper factor relation • Electrical networks • Computer networks • ----------------------------------- • ====> What are the nodes and what are the edges? • ====> Which are undirected and directed graphs?

  8. Graph Definitions cont’d • Subgraph G’=(V’,E’) of Graph G=(V,E) • V’ are from V and E’ from E, and E’ from V’xV’ • Symmetric di-graph: if (v,w) is an edge then (w,v) is also an edge • Complete graph: all possible edges are contained, each pair of vertices are connected • Path: from v node to w node is a sequence of edges that starts at v and ends in w. • Path: {v1, v2, v3,…, vn}, and v1=v, vn=w

  9. Graph - Definitions cont’d • Connected undirected graph: Iff there is a path for each pair of vertices v and w. • Strongly connected directed graph : A digraph iff there is a path from each v to each w (directed!) • Connected component: of a undirected G graph, is a maximal connected subgraph of G. (there could be several connected components).

  10. Graph - Definitions cont’d • Cycle: in directed graph:a path (>0) with the first and last vertices are the same; in undirected graph: as above + all the edges have a unique orientation in the path! • Forest (undirected): an undirected acyclic graph • Tree: a connected undirected acyclic graph

  11. How to define a graph? • Adjacency matrix (A) • In a graph with n nodes, then A is nxn • A has 1 in the A[i][j] element if the ith and jth node are adjacent (linked by an edge) and all the other elements are 0 • Weighted graph: • edges have numeric values assigned (cost or capacity). • Those values are shown in the adjacency matrix. • The adjacency matrix components w/o links are infinity (if cost) or zero (is capacity).

  12. How to define a graph? /2 • Give nodes and list edges • Give edges in an adjacency list structure • List nodes • List all edges linked to the node • When to use adjacency matrix A and when list? • ==> A is efficient for connected/strongly connected graphs. • ==> For sparse graphs adjacency list is better

More Related