Graph Terminology - University Of Washington

6m ago
7 Views
1 Downloads
729.02 KB
42 Pages
Last View : 3m ago
Last Download : 3m ago
Upload by : Milo Davies
Transcription

Graph Terminology CSE 373 Data Structures

Reading Reading Chapter 13 › Sections 13.1 and 13.2 Graph Terminology 2

What are graphs? Yes, this is a graph . But we are interested in a different kind of “graph” Graph Terminology 3

Graphs Graphs are composed of › Nodes (vertices) › Edges (arcs) node edge Graph Terminology 4

Varieties Nodes › Labeled or unlabeled Edges › Directed or undirected › Labeled or unlabeled Graph Terminology 5

Motivation for Graphs Consider the data structures we have looked at so far Linked list: nodes with 1 incoming edge 1 outgoing edge Binary trees/heaps: nodes with 1 incoming edge 2 outgoing edges B-trees: nodes with 1 incoming edge multiple outgoing edges Up-trees: nodes with multiple incoming edges 1 outgoing edge node Value Next node Value Next 94 97 10 a 96 d Graph Terminology g 99 b 6

Motivation for Graphs How can you generalize these data structures? Consider data structures for representing the following problems Graph Terminology 7

Representing a Maze S S B E E Nodes cells Edges door or passage Graph Terminology 8

CSE Course Prerequisites at UW 322 143 321 326 142 370 341 378 Nodes courses Directed edge prerequisite Graph Terminology 421 401 9

Representing Electrical Circuits Battery Nodes battery, switch, resistor, etc. Edges connections Graph Terminology Switch Resistor 10

Program statements x1 q y*z x2 y*z-q Naive: x1 x2 * q y y*z calculated twice common subexpression eliminated: Nodes symbols/operators Edges relationships Graph Terminology * z x1 x2 - q * y q q z 11

Precedence S1 S2 S3 S4 S5 S6 a 0; b 1; c a 1 d b a; e d 1; e c d; 6 5 4 Which statements must execute before S6? S1, S2, S3, S4 Nodes statements Edges precedence requirements Graph Terminology 3 1 2 12

Information Transmission in a Computer Network 56 Tokyo Seattle Seoul 128 16 New York 181 30 140 L.A. Sydney Nodes computers Edges transmission rates Graph Terminology 13

Traffic Flow on Highways UW Nodes cities Edges # vehicles on connecting highway Graph Terminology 14

The Internet Graph Terminology 15

Isomorphism Same number of vertices connected in the same way Time complexity to test if 2 graphs are isomorphic? Graph Terminology 16

Bipartite Graphs Melrose Place Football Player CSE Nerd Two disjoint sets of vertices. Edges link a vertex from one set to a vertex in the other set Graph Terminology 17

Planarity Can the circuit be put onto the chip in one layer? Graph Terminology 18

Related Problems: Puzzles A B C Two problems: 1) Can you draw these without lifting your pen, drawing each line only once 2) Can you start and end at the same point. Graph Terminology 19

Sparsely Connected Graph n vertices n edges total Ring Graph Terminology 20

Densely Connected Graph n vertices total (n (n-1))/2 edges total (w/o self loops) Graph Terminology 21

In Between (Hypercube) n vertices log n edges between two vertices 101 ½ n log n edges total 001 000 Graph Terminology 100 111 011 010 110 22

In Between (Hypercube) 1110 - 16 nodes - 4 edges btwn two nodes 1111 -32 total edges 1010 1011 0010 0111 0110 S: (16,8,16) D: (16,1,120) 0011 0000 1100 H: (32,5,80) 1000 0001 S: (32,16,32) 0100 D: (32,1,496) 0101 S: (64,32,64) H: (64,6,192) 1001 Graph Terminology 1101 D: (64,1,2016) 23

Neural Networks Graph Terminology 24

Colorings Graph Terminology 25

Four Color Conjecture is it true that any map can be colored using four colors in such a way that adjacent regions (i.e. those sharing a common boundary segment, not just a point) receive different colors (1852)? Many attempts at proof Finally “solved” by computer program (1974) › Still extremely complex . Graph Terminology 26

“We should mention that both our programs use only integer arithmetic, and so we need not be concerned with round-off errors and similar dangers of floating point arithmetic. However, an argument can be made that our ‘proof’ is not a proof in the traditional sense, because it contains steps that can never be verified by humans. In particular, we have not proved the correctness of the compiler we compiled our programs on, nor have we proved the infallibility of the hardware we ran our programs on. These have to be taken on faith, and are conceivably a source of error. However, from a practical point of view, the chance of a computer error that appears consistently in exactly the same way on all runs of our programs on all the compilers under all the operating systems that our programs run on is infinitesimally small compared to the chance of a human error during the same amount of case-checking. Apart from this hypothetical possibility of a computer consistently giving an incorrect answer, the rest of our proof can be verified in the same way as traditional mathematical proofs. We concede, however, that verifying a computer program is much more difficult than checking a mathematical proof of the same length.” Graph Terminology 27

Graph Definition A graph is a collection of nodes plus edges › Linked lists, trees, and heaps are all special cases of graphs The nodes are known as vertices (node “vertex”) Formal Definition: A graph G is a pair (V, E) where › V is a set of vertices or nodes › E is a set of edges that connect vertices Graph Terminology 28

Graph Example Here is a graph G (V, E) › Each edge is a pair (v1, v2), where v1, v2 are vertices in V › V {A, B, C, D, E, F} E {(A,B), (A,D), (B,C), (C,D), (C,E), (D,E)} B C A F D E Graph Terminology 29

Directed vs Undirected Graphs If the order of edge pairs (v1, v2) matters, the graph is directed (also called a digraph): (v1, v2) (v2, v1) v1 v2 If the order of edge pairs (v1, v2) does not matter, the graph is called an undirected graph: in this case, (v1, v2) (v2, v1) v1 v2 Graph Terminology 30

Undirected Terminology Two vertices u and v are adjacent in an undirected graph G if {u,v} is an edge in G › edge e {u,v} is incident with vertex u and vertex v The degree of a vertex in an undirected graph is the number of edges incident with it › a self-loop counts twice (both ends count) › denoted with deg(v) Graph Terminology 31

Undirected Terminology B is adjacent to C and C is adjacent to B (A,B) is incident to A and to B B C Self-loop A F D E Degree 0 Degree 3 Graph Terminology 32

Directed Terminology Vertex u is adjacent to vertex v in a directed graph G if (u,v) is an edge in G › vertex u is the initial vertex of (u,v) Vertex v is adjacent from vertex u › vertex v is the terminal (or end) vertex of (u,v) Degree › in-degree is the number of edges with the vertex as the terminal vertex › out-degree is the number of edges with the vertex as the initial vertex Graph Terminology 33

Directed Terminology B adjacent to C and C adjacent from B B C A F D E In-degree 2 Out-degree 1 Graph Terminology In-degree 0 Out-degree 0 34

Handshaking Theorem Let G (V,E) be an undirected graph with E e edges Then 2e deg(v) v V Every edge contributes 1 to the degree of each of the two vertices it is incident with › number of edges is exactly half the sum of deg(v) › the sum of the deg(v) values must be even Graph Terminology 35

Handshaking Theorem II For a directed graph: ind (v) outd (v) e v in G v in g Graph Terminology 36

Graph ADT Nothing unexpected › › › › Build the graph (vertices, edges) Return the edges incident in(or out) of a vertex) Find if two vertices are adjacent etc. Replace , Insert Remove What is interesting › How to represent graphs in memory › What representation to use for what algorithms Graph Terminology 37

Graph Representations Space and time are analyzed in terms of: Number of vertices V and Number of edges E There are at least two ways of representing graphs: The adjacency matrix representation The adjacency list representation Graph Terminology 38

Adjacency Matrix B C A F D E 1 if (v, w) is in E M(v, w) 0 otherwise A B C D E F A 0 1 0 1 0 0 B 1 0 1 0 0 0 C 0 1 0 1 1 0 D 1 0 1 0 1 0 E 0 0 1 1 0 0 F 0 0 0 0 0 0 Space V 2 Graph Terminology 39

Adjacency Matrix for a Digraph B C A F D E 1 if (v, w) is in E M(v, w) 0 otherwise A B C D E F A 0 1 0 1 0 0 B 0 0 1 0 0 0 C 0 0 0 1 1 0 D 0 0 0 0 1 0 E 0 0 0 0 0 0 F 0 0 0 0 0 0 Space V 2 Graph Terminology 40

Adjacency List For each v in V, L(v) list of w such that (v, w) is in E a b B C A F D E A B D B A C C B D E D A C E E C D F Graph Terminology Space a V 2 b E 41

Adjacency List for a Digraph For each v in V, L(v) list of w such that (v, w) is in E a b B C A F D E A B B C C D D E D E E F Graph Terminology Space a V b E 42

Motivation for Graphs Consider the data structures we have looked at so far Linked list: nodes with 1 incoming edge 1 outgoing edge Binary trees/heaps: nodes with 1 incoming edge 2 outgoing edges B-trees: nodes with 1 incoming edge multiple outgoing edges Up-trees: nodes with multiple incoming edges 1 outgoing edge .

Related Documents:

The totality of these behaviors is the graph schema. Drawing a graph schema . The best way to represent a graph schema is, of course, a graph. This is how the graph schema looks for the classic Tinkerpop graph. Figure 2: Example graph schema shown as a property graph . The graph schema is pretty much a property-graph.

Oracle Database Spatial and Graph In-memory parallel graph analytics server (PGX) Load graph into memory for analysis . Command-line submission of graph queries Graph visualization tool APIs to update graph store : Graph Store In-Memory Graph Graph Analytics : Oracle Database Application : Shell, Zeppelin : Viz .

a graph database framework. The proposed approach targets two kinds of graph models: - IFC Meta Graph (IMG) based on the IFC EXPRESS schema - IFC Objects Graph (IOG) based on STEP Physical File (SPF) format. Beside the automatic conversation of IFC models into graph database this paper aims to demonstrate the potential of using graph databases .

1.14 About Oracle Graph Server and Client Accessibility 1-57. 2 . Quick Starts for Using Oracle Property Graph. 2.1 Using Sample Data for Graph Analysis 2-1 2.1.1 Importing Data from CSV Files 2-1 2.2 Quick Start: Interactively Analyze Graph Data 2-3 2.2.1 Quick Start: Create and Query a Graph in the Database, Load into Graph Server (PGX) for .

1.14 About Oracle Graph Server and Client Accessibility 1-46. 2 . Quick Starts for Using Oracle Property Graph. 2.1 Using Sample Data for Graph Analysis 2-1 2.1.1 Importing Data from CSV Files 2-1 2.2 Quick Start: Interactively Analyze Graph Data 2-3 2.2.1 Quick Start: Create and Query a Graph in the Database, Load into Graph Server (PGX) for .

Basic Operations Following are basic primary operations of a Graph Add Vertex Adds a vertex to the graph. Add Edge Adds an edge between the two vertices of the graph. Display Vertex Displays a vertex of the graph. To know more about Graph, please read Graph Theory Tutorial.

Graph Mining and Graph Kernels An Introduction to Graph Mining Graph Pattern Explosion Problem ! If a graph is frequent, all of its subgraphs are frequent the Apriori property! An n-edge frequent graph may have 2n subgraphs!! In the AIDS antiviral screen dataset with 400 compounds, at the su

Introduction Pages 1{3 More Graph Theory Complete graph K 5, complete bipartite graph K 3;3, and the Petersen graph Forbidden Graph Characterizations A minor H of a graph G is the result of a sequence of operations: Contraction (merge two adjacent vertices), edge and vertex deletion. A graph