Topics Intro to Graphs 11 1 A C




















- Slides: 20
Topics • Intro. to Graphs (11. 1) A C B E D F G 1
Definition (p. 650) • A graph G = V(G) + E(G) • A set of vertices (or nodes), V(G) = {v 1, v 2, …, vn} • A set of edges (or arcs) E(G) = {<vi, vj> | vi V(G) and vj V(G) } • Exercise: Draw the graph G, where V(G) = {a, b, c, d, e, f}, and E(G) = {e 1: <a, c>, e 2: <a, b>, e 3: <c, d>, e 4: <c, c>, e 5: <d, a>, e 6: <d, c>, e 7: <e, f>} – – – List all the vertices adjacent to vertex c. List all the edges adjacent to edge e 3. What are the edges incident on vertex d? Is there any loop in G? Is there any isolated vertex? Are there any parallel edges? 2
Interpretation of Graphs • What could the following graph represent? A graph with 6 vertices and 7 edges. Source: http: //en. wikipedia. org/wiki/Graph_%28 mathematics%29 3
Directed Graphs (p. 653) • A directed graph (or digraph) G = V(G) + E(G) • A set of vertices, V(G) = {v 1, v 2, …, vn} • A set of directed edges (or arrows), E(G) = {<vi, vj> | vi V(G) and vj V(G) } Each <vi, vj> is an ordered pair. vi: the head vj: the tail vi is the direct predecessor of vj vj is the direct successor of vi • Exercise: Draw the digraph G, where V(G) = {a, b, c, d, e, f} and E(G) = {e 1: <a, c>, e 2: <a, b>, e 3: <c, d>, e 4: <c, c>, e 5: <d, a>, e 6: <d, c>, e 7: <e, f>} 4
Sociograms • A sociogram is a graphic representation of relationships among individuals. See http: //en. wikipedia. org/wiki/Sociogram. A vertex in a sociogram represents an individual. A directed edge represents ‘friendship’ or ‘flow of information’. • Exercise: Show V(G) and E(G) in the following digraph. • Is there any star in the sociogram? • Any isolates? • Does there exist any clique? • Is there a way for G to pass information to F? • Could G pass information to A? • Could A pass information to G? A C B E D F G 5
More Examples of Graphs • pp. 654 -655: – Knowledge representation – Problem solving 6
Is a diagram a graph? • Not necessarily • But sometimes (e. g. , Hasse diagrams, pp. 636 -639) • A diagram is a 2 D symbolic representation of information according to some visualization technique. • Three main types of diagrams: – Graph-based diagrams (tree diagram, network diagram, flowchart, …) – Chart-like diagrams (histogram, pie chart, function graph, …) – Other types of diagrams (exploded view) See http: //en. wikipedia. org/wiki/Diagram for a comprehensive list of specific diagram types. 7
Network Diagrams A sample network diagram: http: //en. wikipedia. org/wiki/Network_diagram 8
A network diagram for the Distributed Computer Security Lab: See http: //www. dcsl-uhcl. net/public/DCSL%20 diagram. html 9
A Sensor Network Topology • Source: http: //www. purelink. ca/images/sensor_network_big. gif 10
• A sample UML (Unified Modeling Language) diagram http: //sce. uhcl. edu/yang/teaching/csci 5333 Fall 04/uml%20 company%20 DB. gif 11
Questions? 12
Simple Graphs p. 656: A simple graph is an undirected graph with no loops or • parallel edges. • A complete graph on n vertices, Kn, is a simple graph with n vertices v 1, v 2, …, vn whose set of edges contains exactly one edge for each pair of distinct vertices. • Q: Which of the following are simple graphs? Which are complete graphs? A A A B B (a) C (b) B C A B (f) (d) A X B C (g) A B (c) A B A A X B C Y C (e) (h) C Y (i) 13
Complete Graphs • Q: How many edges are there in a complete graph on n vertices, Kn? • Number of edges in Kn = 1+2+…+(n-1) = n edges 1 0 2 1 3 1+2 4 1+2+3 n 1+2+…+(n-1) 14
Bipartite Graphs • A bipartite graph (or bigraph) is a graph whose vertices can be divided into two disjoint sets U and V such that every edge connects a vertex in U to one in V. (Source: http: //en. wikipedia. org/wiki/Bipartite_graph) A X B Y C 15
Complete Bipartite Graphs • A complete bipartite graph, Km, n • Definition: p. 657 A X B Y C • Q: How many edges are there in a complete bipartite graph Km, n? • Number of edges in Km, n = K 3, 2 16
Subgraphs p. 657: A graph H is a subgraph of a graph G iff • a. b. c. 1. Every vertex in H is also in G. Every edge in H has the same endpoints as in G. Example 11. 1. 10 2. Remember the cliques in the example sociogram? A clique is a complete subgraph. A C B E D F G • Subgraphs of a graph which are cliques may be referred to as cliques in that graph. • The largest clique in a graph G is of theoretical importance and denoted ω(G). 17
The Concept of Degree • The degree of a vertex v deg(v) = the number of edges that are incident on v Note: A loop on v is counted twice. • The total degree of a graph G with n vertices = = 2(the number of edges in G) the Handshake Theorem (p. 659) • Example 11. 1. 11: p. 658 18
The Handshake Theorem • Therefore, the total degree of a graph is even. • Also, the number of vertices with odd degree is even (p. 661) • Useful when determining whether a graph with certain properties exists or not. • Example 11. 1. 12 • Example 11. 1. 14 19
Questions? 20