1 / 32

Module #19: Graph Theory: part II

Module #19: Graph Theory: part II. Rosen 5 th ed., chs. 8-9. §8.3: Graph Representations & Isomorphism. Graph representations: Adjacency lists. Adjacency matrices. Incidence matrices. Graph isomorphism: Two graphs are isomorphic iff they are identical except for their node names.

Download Presentation

Module #19: Graph Theory: part II

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. Module #19:Graph Theory: part II Rosen 5th ed., chs. 8-9

  2. §8.3: Graph Representations & Isomorphism • Graph representations: • Adjacency lists. • Adjacency matrices. • Incidence matrices. • Graph isomorphism: • Two graphs are isomorphic iff they are identical except for their node names.

  3. Adjacency Lists • A table with 1 row per vertex, listing its adjacent vertices. b a d c e f

  4. Directed Adjacency Lists • 1 row per node, listing the terminal nodes of each edge incident from that node.

  5. Adjacency Matrices • Matrix A=[aij], where aij is 1 if {vi, vj} is an edge of G, 0 otherwise. a b c d a a b b d c c d

  6. Adjacency Matrices for pseudo graph • Matrix A=[aij], where aij is the number of edges that are associated to {vi, vj} a b c d a a b b c c d d

  7. Incidence matrices • Matrix M=[mij], where mij is 1 when edge ej is incident with vi, 0 otherwise e1 e2 e3 e4 e5 v1 e2 v4 e3 v1 e1 e4 v2 e5 v2 v3 v3 v4

  8. Graph Isomorphism • Formal definition: • Simple graphs G1=(V1, E1) and G2=(V2, E2) are isomorphic iff  a bijection f:V1V2 such that  a,bV1, a and b are adjacent in G1 iff f(a) and f(b) are adjacent in G2. • f is the “renaming” function that makes the two graphs identical. • Definition can easily be extended to other types of graphs.

  9. Graph Invariants under Isomorphism Necessary but not sufficient conditions for G1=(V1, E1) to be isomorphic to G2=(V2, E2): • |V1|=|V2|, |E1|=|E2|. • The number of vertices with degree n is the same in both graphs. • For every proper subgraph g of one graph, there is a proper subgraph of the other graph that is isomorphic to g.

  10. Isomorphism Example • If isomorphic, label the 2nd graph to show the isomorphism, else identify difference. d b b a a d c e f e c f

  11. Are These Isomorphic? • If isomorphic, label the 2nd graph to show the isomorphism, else identify difference. * Same # of vertices a b * Same # of edges d * Different # of vertices of degree 2! (1 vs 3) e c Example 11: a more general solution

  12. §8.4: Connectivity • In an undirected graph, a path of length n from u to v is a sequence of adjacent edges going from vertex u to vertex v. • A path is a circuit if u=v. • A path traverses the vertices along it. • A path or circuit is simple if it contains no edge more than once.

  13. Paths in Directed Graphs • Same as in undirected graphs, but the path must go in the direction of the arrows.

  14. Small world • Human relationship as a graph • Stanley Milgram’s “small world” experiment • Stanley Milgram: The Small World Problem, Psychology Today, 1(1), 60-67 (1967) • range = 2-10, median = 5 • http://backspaces.net/PLaw/ • Oracle of Bacon • http://www.cs.virginia.edu/oracle/ • The Erdös Number Project • http://www.oakland.edu/enp/ • Tables in p. 569

  15. Connectedness • An undirected graph is connected iff there is a path between every pair of distinct vertices in the graph. • Theorem: There is a simple path between any pair of vertices in a connected undirected graph. • A component is a maximal connected subgraph. • Connected component, connected subgraph • A cut vertex or cut edge (bridge) separates 1 connected component into 2 if removed.

  16. Directed Connectedness • A directed graph is strongly connected iff there is a directed path from a to b for any two vertices a and b. • It is weakly connected iff the underlyingundirected graph (i.e., with edge directions removed) is connected. • Note strongly implies weakly but not vice-versa.

  17. Paths & Isomorphism • Note that connectedness, and the existence of a circuit or simple circuit of length k are graph invariants with respect to isomorphism. • Examples 12, 13

  18. Counting Paths w Adjacency Matrices • Let A be the adjacency matrix of graph G. • The number of paths of length k from vi to vj is equal to (Ak)i,j. (The notation (M)i,j denotes mi,j where [mi,j] = M.) a b c d a b a b d c c d ab c

  19. §8.5: Euler & Hamilton Paths • An Euler circuit in a graph G is a simple circuit containing every edge of G. • An Euler path in G is a simple path containing every edge of G. • A Hamilton circuit is a circuit that traverses each vertex in G exactly once. • initial vertex is twice • A Hamilton path is a path that traverses each vertex in G exactly once.

  20. Euler path 1 2 3 start finish 4 6 5

  21. Euler circuit 1 2 3 start 7 4 6 5

  22. Hamilton Circuits and Paths • Gray circle is the starting vertex; follow the red lines • removing one edge (dashed line) from a Hamilton circuit makes a Hamilton path • - In some graphs, there are only Hamilton paths, not Hamilton circuits

  23. Module #19:Tree Rosen 5th ed., ch. 9

  24. Trees Uses • Trees are, by far, the most algorithmically and theoretically interesting structure in computer science, since they are used to solve a wide range of problems • Even algorithms themselves are depicted as trees, as can be seen in decision trees and (some) flowcharts (the ones that aren't cyclic) • The usefulness of trees are enormous, and we'll only touch the surface

  25. Definition • A tree is a connected graph with no cycles • E.g., tournament brackets, family trees, organizational charts • A forest is a graph whose components are trees.

  26. Trees: Leaves & Internal Vertices • In the following tree the red vertices are leaves. The other vertices are internal vertices.

  27. Rooted Trees • Sometimes it is useful to distinguish one vertex of a tree and call it the root of the tree. For instance we might, for whatever reasons, take the tree above and declare the red vertex to be its root. In that case we often redraw the tree to let it all “hang down” from the root

  28. Rooted Directed Trees • It is sometimes useful to turn a rooted tree into a rooted directed tree T′ by directing every edge away from the root.

  29. Rooted Trees: Terminology • Some terminology is suggested by family trees. The level of a vertex is the length of the path from it to the root. (The level of the root is 0.) The height of the tree is the length of the longest path from a leaf to the root. • If there is a directed edge in T′ from a to b, then a is the parent of b and b is a child of a. • If there are directed edges in T′ from a to b and c, then b and c are siblings. • If there is a directed path from a to b, then a is an ancestor of b and b is a descendant of a. • A subtree is a vertex and all its descendants “Directed” can be omitted in undirected graphs, but …

  30. (Rooted) Trees: Binary & m-ary • A directed tree is binary if no vertex has outdegree over 2. • A directed tree m-ary if no vertex has outdegree over m • It is more common to call a tree binary if no vertex has degree over 3. • In general a tree is m-ary if no vertex has degree over m+1. • In a rooted binary tree, one can describe each child vertex as the left child or right child of its parent. Left subtree, right subtree

  31. Full, balanced • A rooted tree is a full m-ary tree if every internal vertex has exactly m children. • A rooted m-ary tree of height h is balanced if all leaves are at levels h or h-1 • What is a full, balanced m-ary tree?

  32. Final exam • Slides • Chapter 5 • Sections 1,2,3 • Chapter 6 • Sections 1,2,3 • 6.2 Theorem 6 is excluded • Chapter 7 • Sections 1,2,3,4,5,6 • Chapter 8 • Sections 1,2,3,4,5 • Chapter 9 • Section 1 Chs 8,9 에서 O,X 문제 혹은 증명 문제가 나올 수 있음, 단 8.5 제외

More Related