Graphs and Matrix Storage Structures EEE 574 Dr. Dan Tylavsky.

Slides:



Advertisements
Similar presentations
Lecture 15. Graph Algorithms
Advertisements

CHP-5 LinkedList.
Algorithms (and Datastructures) Lecture 3 MAS 714 part 2 Hartmut Klauck.
CS 473Lecture 131 CS473-Algorithms I Lecture 13-A Graphs.
CSE115/ENGR160 Discrete Mathematics 04/26/12 Ming-Hsuan Yang UC Merced 1.
Elementary Data Structures: Part 2: Strings, 2D Arrays, Graphs
Review Binary Search Trees Operations on Binary Search Tree
ECE 552 Numerical Circuit Analysis Chapter Four SPARSE MATRIX SOLUTION TECHNIQUES Copyright © I. Hajj 2012 All rights reserved.
Introduction This chapter explores graphs and their applications in computer science This chapter explores graphs and their applications in computer science.
Data Structure and Algorithms (BCS 1223) GRAPH. Introduction of Graph A graph G consists of two things: 1.A set V of elements called nodes(or points or.
Sparse Matrix Storage Lecture #3 EEE 574 Dr. Dan Tylavsky.
C++ Programming: Program Design Including Data Structures, Third Edition Chapter 21: Graphs.
Numerical Triangular Factorization Lecture #11 EEE 574 Dr. Dan Tylavsky.
Sparse Triangular Matrix Equations Lecture #6 EEE 574 Dr. Dan Tylavsky.
Sparse Vector & Matrix Algebra Lecture #4 EEE 574 Dr. Dan Tylavsky.
Chapter 9 Graph algorithms. Sample Graph Problems Path problems. Connectedness problems. Spanning tree problems.
Nyhoff, ADTs, Data Structures and Problem Solving with C++, Second Edition, © 2005 Pearson Education, Inc. All rights reserved Graphs.
Introduction to Graphs
Lecture #15 EEE 574 Dr. Dan Tylavsky Breaker to Bus Modeling.
Fill Lecture #9 EEE 574 Dr. Dan Tylavsky. Fill © Copyright 1999 Daniel Tylavsky 4 When we solve Ax=b, (A sparse), fill-in will occur in the L,U factor.
Lecture #12 EEE 574 Dr. Dan Tylavsky Optimal Ordering.
Chapter 9 Graph algorithms Lec 21 Dec 1, Sample Graph Problems Path problems. Connectedness problems. Spanning tree problems.
Graphs G = (V,E) V is the vertex set. Vertices are also called nodes and points. E is the edge set. Each edge connects two different vertices. Edges are.
Graph Operations And Representation. Sample Graph Problems Path problems. Connectedness problems. Spanning tree problems.
9.3 Representing Graphs and Graph Isomorphism
Graphs, relations and matrices
Chapter 9 1. Chapter Summary Relations and Their Properties n-ary Relations and Their Applications (not currently included in overheads) Representing.
Graph. Data Structures Linear data structures: –Array, linked list, stack, queue Non linear data structures: –Tree, binary tree, graph and digraph.
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
Computer Science 112 Fundamentals of Programming II Introduction to Graphs.
Graph Dr. Bernard Chen Ph.D. University of Central Arkansas.
GRAPHS CSE, POSTECH. Chapter 16 covers the following topics Graph terminology: vertex, edge, adjacent, incident, degree, cycle, path, connected component,
Nyhoff, ADTs, Data Structures and Problem Solving with C++, Second Edition, © 2005 Pearson Education, Inc. All rights reserved Graphs.
Discrete Math for CS Binary Relation: A binary relation between sets A and B is a subset of the Cartesian Product A x B. If A = B we say that the relation.
Chapter 9. Section 9.1 Binary Relations Definition: A binary relation R from a set A to a set B is a subset R ⊆ A × B. Example: Let A = { 0, 1,2 } and.
Nyhoff, ADTs, Data Structures and Problem Solving with C++, Second Edition, © 2005 Pearson Education, Inc. All rights reserved Graphs.
Graphs CSE 2011 Winter June Graphs A graph is a pair (V, E), where  V is a set of nodes, called vertices  E is a collection of pairs.
Data Structures & Algorithms Graphs
ITEC 2620A Introduction to Data Structures Instructor: Prof. Z. Yang Course Website: 2620a.htm Office: TEL 3049.
Data Structures CSCI 132, Spring 2014 Lecture 38 Graphs
Relation. Combining Relations Because relations from A to B are subsets of A x B, two relations from A to B can be combined in any way two sets can be.
ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.
Graphs A graphs is an abstract representation of a set of objects, called vertices or nodes, where some pairs of the objects are connected by links, called.
1 Directed Graphs Chapter 8. 2 Objectives You will be able to: Say what a directed graph is. Describe two ways to represent a directed graph: Adjacency.
Data Structures & Algorithms Graphs Richard Newman based on book by R. Sedgewick and slides by S. Sahni.
Graphs 황승원 Fall 2010 CSE, POSTECH. 2 2 Graphs G = (V,E) V is the vertex set. Vertices are also called nodes and points. E is the edge set. Each edge connects.
GRAPHS. Graph Graph terminology: vertex, edge, adjacent, incident, degree, cycle, path, connected component, spanning tree Types of graphs: undirected,
Graphs Basic properties.
Graphs Upon completion you will be able to:
Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A.
ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.
1 Chapter 2 Notation and Definitions Data Structures Transformations.
Introduction to Graph Theory By: Arun Kumar (Asst. Professor) (Asst. Professor)
Chapter 20: Graphs. Objectives In this chapter, you will: – Learn about graphs – Become familiar with the basic terminology of graph theory – Discover.
Design and Analysis of Algorithms Introduction to graphs, representations of a graph Haidong Xue Summer 2012, at GSU.
Graph Representations And Traversals. Graphs Graph : – Set of Vertices (Nodes) – Set of Edges connecting vertices (u, v) : edge connecting Origin: u Destination:
Solution of Sparse Linear Systems Numerical Simulation CSE245 Thanks to: Kin Sou, Deepak Ramaswamy, Michal Rewienski, Jacob White, Shihhsien Kuo and Karen.
1 GRAPH Learning Outcomes Students should be able to: Explain basic terminology of a graph Identify Euler and Hamiltonian cycle Represent graphs using.
Lecture 20. Graphs and network models 1. Recap Binary search tree is a special binary tree which is designed to make the search of elements or keys in.
Subject Four Graphs Data Structures. What is a graph? A data structure that consists of a set of nodes (vertices) and a set of edges that relate the nodes.
Graphs.
Matrix Representation of Graphs
Matrix Representation of Graph
Graphs CSE 2011 Winter November 2018.
Graph Operations And Representation
Graphs.
Graphs G = (V, E) V are the vertices; E are the edges.
GRAPHS.
Introduction to Graphs
Presentation transcript:

Graphs and Matrix Storage Structures EEE 574 Dr. Dan Tylavsky

Graphs & Matrix Storage Structures © Copyright 1999 Daniel Tylavsky 4 In order to perform calculations on electric power networks we’ll need to have a way of representing them. 4 The mathematical equivalent of a network is a graph. 4 Some definitions: –Graph - G(U,E) consists of a set, U, of vertices (nodes) and a set, E, of edges (branches). –Edge (branch) - is uniquely determined by a pair of distinct vertices, (u,v).

Graphs & Matrix Storage Structures © Copyright 1999 Daniel Tylavsky 4 More definitions: –Digraph - a graph in which each edge, characterized by an ordered pair of vertices, (u,v), has an orientation from u to v. –Undirected graph - A graph in which edges have no orientation. (We’ll use this for our networks.) –Adjacency - A vertex, u, is adjacent to a vertex, v, if an edge (u,v) exists.

Graphs & Matrix Storage Structures © Copyright 1999 Daniel Tylavsky 4 More definitions: –Adjacency Data Structure of a Graph - For each graph vertex, the list of adjacent vertices is store in compact form. All compact forms are stored in one array.

Graphs & Matrix Storage Structures © Copyright 1999 Daniel Tylavsky     Node -List of Adjacent Nodes ERP - End of Row Pointer Advantages 1) Storage space is reasonable. 2) Easy to retrieve data values (individual and strings) 3)Coding is simple Disadvantages 1) Not easy to modify. 2) Meaning of data not easily obtained. 3) Edges stored twice. Pointing to end of each row means our last pointer points to last element in Node(k).

Graphs & Matrix Storage Structures © Copyright 1999 Daniel Tylavsky To find the number of connections to each node, say node j: # Conx Node j = ERP(j)-ERP(j-1) For node 1: # Conx Node 1 = ERP(1)-ERP(0) (Explains why we must start our arrays at position 0.) To list all nodes attached to a given node use the Fortran code: Integer NODE(0:MXBR), ERP(0:MXBS) Nod=? Ibeg=ERP(Nod-1)+1 Iend=ERP(Nod) Write(6,10) (List(I), I=Ibeg,Iend) 10 Format(….)

Graphs & Matrix Storage Structures © Copyright 1999 Daniel Tylavsky –How do we add a branch between 1 and 3 into this data structure? –Shift node values to make space to add node 3 to bus 1 list and node 1 to bus 3 list. –Add node 3 to bus 1 list and node 1 to bus 3 list. –Update End of Row Pointers. –Because of difficulties with adding (or deleting) we use the adjacency structure for static data storage.

Graphs & Matrix Storage Structures © Copyright 1999 Daniel Tylavsky –Let’s store the same information using a linked list: (Note: Sets are not disjoint.)     –To add a branch between 1 and 3: Pointer to available linked list storage. –Linked list structure is much easier to modify but requires more memory. –We use it when data changes dynamically.

Graphs & Matrix Storage Structures © Copyright 1999 Daniel Tylavsky –To eliminate a branch between 2 and 4. –Enter linked list for node 2, find node 4. Eliminate link.     Pointer to available linked list storage. –Linked list structure is much easier to modify but requires more memory. -3 9

Graphs & Matrix Storage Structures © Copyright 1999 Daniel Tylavsky     Teams: Modify the existing data structure to account for the removal of the branch (1,2) and addition of a node connected by a branch to node 3. 

Graphs & Matrix Storage Structures © Copyright 1999 Daniel Tylavsky 4 There is a correspondence between graph storage and sparse matrices. 4 Recall the rules for constructing the nodal admittance matrix: –Let y ij be the branch admittance between nodes i and j. –Let node 0 be the ground or reference node (not shown on our diagrams).

Graphs & Matrix Storage Structures © Copyright 1999 Daniel Tylavsky     –Note that the nodal admittance matrix is symmetric, that is y ij =y ji. –Let’s look a means for storing symmetric matrices.

Graphs & Matrix Storage Structures © Copyright 1999 Daniel Tylavsky Symmetric matrix storage using an adjacency structure.     –Then adjust the structure to accommodate the matrix. –Then include an array corresponding to the values in the matrix. –Let’s first construct adjacency structure for storing the graph,

Graphs & Matrix Storage Structures © Copyright 1999 Daniel Tylavsky –This adjacency structure is known as: Row-Wise Representation (Complete) Unordered (RR(C)U) –It is unordered because the node #’s with non-zero’s in each row are listed in neither ascending nor descending order. –An RR(C)O (Ordered) form is:

Graphs & Matrix Storage Structures © Copyright 1999 Daniel Tylavsky 4 Symmetric matrix storage using an adjacency structure (cont’d). –CR(C)O Column-wise representation (complete) ordered. (Same as RR(C)O for symmetric matrices) –CR(C)U (Unordered) - Same as RR(C)U for symmetric matrices.

Graphs & Matrix Storage Structures © Copyright 1999 Daniel Tylavsky 4 Symmetric matrix storage using an adjacency structure (cont’d). –If the matrices are symmetric, we need only store the upper half of the matrix: RR(DU)O/U Row-wise rep. (diagonal & upper) ordered /unordered. Same as CR(DL)O/U Column-wise rep. (diagonal & lower) ordered /unordered.

Graphs & Matrix Storage Structures © Copyright 1999 Daniel Tylavsky 4 Symmetric matrix storage using an adjacency structure (cont’d). –A more minimal storage technique: RR(U)O/U Row-wise rep. (upper) ordered /unordered. –It is convenient (esp. in positive definite matrices) to store the diagonal separately.

Graphs & Matrix Storage Structures © Copyright 1999 Daniel Tylavsky Teams: Compare RR(DU)X and RR(U)X storage schemes applied to the same matrix as shown below. Which requires less storage space? Where does the savings come from? RR(DU)O RR(U)O

Graphs & Matrix Storage Structures © Copyright 1999 Daniel Tylavsky 4 Symmetric matrix storage using a linked list structure. –Any of the forgoing storage techniques can be implemented with a linked list structure. –Consider RR(DU)O using a linked list sturcture. Here we have used as the last link of each row, the negative of the row index. This allows you to search Y then identify the row and column index of the element found.

Graphs & Matrix Storage Structures © Copyright 1999 Daniel Tylavsky 4 Incidence symmetric matrix storage using an adjacency structure (cont’d). –Incidence symmetric matrix - A matrix whose sparsity pattern is symmetric, but whose numerical content is not symmetric. –L-D-U RO/U - Lower-Diagonal-Upper Representation Ordered/Unordered. (This is an adaptation of the RR(U)x scheme for incidence symmetric matrices.

Graphs & Matrix Storage Structures © Copyright 1999 Daniel Tylavsky –Apply L-D-U RU to the following matrix. –YU is stored by rows. –YL is stored by columns. –Indx contains col. indices for YU, row indices for YL.

Graphs & Matrix Storage Structures © Copyright 1999 Daniel Tylavsky 4 Incidence symmetric matrix storage using an adjacency structure (cont’d). –When using a Newton-Raphson Method we get matrices that have a block-incidence symmetric form. –BRR(C)O/U Block- Row-Wise Representation (Complete) Ordered/Unordered.

Graphs & Matrix Storage Structures © Copyright 1999 Daniel Tylavsky –Apply BRR(C)O/U to the following matrix

The End

Graphs & Matrix Storage Structures © Copyright 1999 Daniel Tylavsky –Let’s look at some other storage schemes: –Knuth’s Storage: