Graphs and Matrices Spring 2012 Mills College Dan Ryan Lecture Slides by Dan Ryan is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike.

Slides:



Advertisements
Similar presentations
CSNB143 – Discrete Structure
Advertisements

Chapter Matrices Matrix Arithmetic
1 Slides based on those of Kenneth H. Rosen Slides by Sylvia Sorkin, Community College of Baltimore County - Essex Campus Graphs.
Lecture 17 Path Algebra Matrix multiplication of adjacency matrices of directed graphs give important information about the graphs. Manipulating these.
Mathematics. Matrices and Determinants-1 Session.
Matrix Multiplication To Multiply matrix A by matrix B: Multiply corresponding entries and then add the resulting products (1)(-1)+ (2)(3) Multiply each.
Maths for Computer Graphics
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 12 System of Linear Equations.
CALCULUS – II Matrix Multiplication by Dr. Eman Saad & Dr. Shorouk Ossama.
Chapter 9: Graphs Basic Concepts
Module 6 Matrices & Applications Chapter 26 Matrices and Applications I.
Graphs, relations and matrices
Arithmetic Operations on Matrices. 1. Definition of Matrix 2. Column, Row and Square Matrix 3. Addition and Subtraction of Matrices 4. Multiplying Row.
MATRICES. Matrices A matrix is a rectangular array of objects (usually numbers) arranged in m horizontal rows and n vertical columns. A matrix with m.
CE 311 K - Introduction to Computer Methods Daene C. McKinney
3.8 Matrices.
Chapter 1: Matrices Definition 1: A matrix is a rectangular array of numbers arranged in horizontal rows and vertical columns. EXAMPLE:
Division in the Integers Theorem 1. If n and m are integers and n>0, then m=qn+r for unique integers q and r with 0
Recall the distributive property of multiplication over addition... symbolically: a × (b + c) = a × b + a × c and pictorially (rectangular array area model):
ECON 1150 Matrix Operations Special Matrices
Chapter 2 Graph Algorithms.
Chapter 4 sections 1 and 2.  Fig. 1  Not connected  All vertices are even.  Fig. 2  Connected  All vertices are even.
 What is a graph? What is a graph?  Directed vs. undirected graphs Directed vs. undirected graphs  Trees vs graphs Trees vs graphs  Terminology: Degree.
Week 11 - Wednesday.  What did we talk about last time?  Graphs  Euler paths and tours.
Matrices. A matrix, A, is a rectangular collection of numbers. A matrix with “m” rows and “n” columns is said to have order m x n. Each entry, or element,
Vertices and Edges Introduction to Graphs and Networks Mills College Spring 2012.
Chapter 4 – Matrix CSNB 143 Discrete Mathematical Structures.
Computing the chromatic number for block intersection graphs of Latin squares Ed Sykes CS 721 project McMaster University, December 2004 Slide 1.
Week 11 - Monday.  What did we talk about last time?  Binomial theorem and Pascal's triangle  Conditional probability  Bayes’ theorem.
Slide Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley.
2009/9 1 Matrices(§3.8)  A matrix is a rectangular array of objects (usually numbers).  An m  n (“m by n”) matrix has exactly m horizontal rows, and.
Fundamental Data Structures and Algorithms (Spring ’05) Recitation Notes: Graphs Slides prepared by Uri Dekel, Based on recitation.
Meeting 18 Matrix Operations. Matrix If A is an m x n matrix - that is, a matrix with m rows and n columns – then the scalar entry in the i th row and.
Vocabulary and Representations of Graphs. NC Standard Course of Study Competency Goal 1: The learner will use matrices and graphs to model relationships.
Data Structures CSCI 132, Spring 2014 Lecture 38 Graphs
CSCI 171 Presentation 9 Matrix Theory. Matrix – Rectangular array –i th row, j th column, i,j element –Square matrix, diagonal –Diagonal matrix –Equality.
Matrices Section 2.6. Section Summary Definition of a Matrix Matrix Arithmetic Transposes and Powers of Arithmetic Zero-One matrices.
CSNB143 – Discrete Structure Topic 3 – Matrices. Learning Outcomes Students should understand all matrices operations. Students should be able to differentiate.
Representing Relations Using Matrices A relation between finite sets can be represented using a zero-one matrix Suppose R is a relation from A = {a 1,
Computer Graphics Matrices
MATRICES Operations with Matrices Properties of Matrix Operations
Department of Computer Engineering Faculty of Engineering, Prince of Songkla University Graphs Original Slides by Rada Mihalcea.
1 Closures of Relations Based on Aaron Bloomfield Modified by Longin Jan Latecki Rosen, Section 8.4.
Conjecture: PQ = ½ (AD – BC). 2.In quadrilateral ABCD, the measures of angles A, B, C and D, in that order, form an increasing arithmetic sequence.
Week 11 - Wednesday.  What did we talk about last time?  Graphs  Paths and circuits.
Section 2.4. Section Summary  Sequences. o Examples: Geometric Progression, Arithmetic Progression  Recurrence Relations o Example: Fibonacci Sequence.
MATRICES. Introduction Matrix algebra has several uses in economics as well as other fields of study. One important application of Matrices is that it.
CS 285- Discrete Mathematics Lecture 11. Section 3.8 Matrices Introduction Matrix Arithmetic Transposes and Power of Matrices Zero – One Matrices Boolean.
A very brief introduction to Matrix (Section 2.7) Definitions Some properties Basic matrix operations Zero-One (Boolean) matrices.
Matrices. Matrix A matrix is an ordered rectangular array of numbers. The entry in the i th row and j th column is denoted by a ij. Ex. 4 Columns 3 Rows.
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.
13.4 Product of Two Matrices
Linear Algebra Lecture 2.
1.5 Matricies.
Matrix Representation of Graphs
Basic Concepts Graphs For more notes and topics visit:
MATHEMATICS Matrix Multiplication
Matrix Multiplication
Multiplication of Matrices
abstract containers sequence/linear (1 to 1) hierarchical (1 to many)
4.3 Paths in Relations and Digraphs
abstract containers sequence/linear (1 to 1) hierarchical (1 to many)
Chapter 9: Graphs Basic Concepts
CS100: Discrete structures
Matrices and Matrix Operations
Graphs G = (V, E) V are the vertices; E are the edges.
GRAPHS G=<V,E> Adjacent vertices Undirected graph
abstract containers sequence/linear (1 to 1) hierarchical (1 to many)
Multiplication of Matrices
Chapter 9: Graphs Basic Concepts
Presentation transcript:

Graphs and Matrices Spring 2012 Mills College Dan Ryan Lecture Slides by Dan Ryan is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.Dan RyanCreative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License

Four Representations of a Graph G={V,E} NODE List A B D E B A C D C A B D D A B C E A EDGE List AB AD AE BA BC BD CA CB CD DA DB DC EA A C B D E MATRIX

Matrix ROWSCOLUMNS A matrix ELEMENT The MAIN DIAGONAL SQUARE MATRIX RECTANGULAR MATRIX

Nomenclature: nrows by mcols x2 matrix 2x4 matrix 3x1 matrix 3x3 matrix

Matrix

Sometimes we say “Vector” Each row (or column) in a matrix can be thought of as an ordered set of numbers describing an object. For a graph matrix, a row or a column is a “vector” of a vertex’s connections The fourth vertex is connected to the first, second, and third, but not the fifth

Transpose The transpose of a matrix is a swapping of its rows and columns

Transposing a Matrix transpose i j

Matrix Arithmetic

Example: Convert 2-Mode to 1-Mode(s) 1.Write the rectangular incidence matrix I A 123 BDC ABCD GROUPS PEOPLE A “groups by people” matrix

Example: Convert 2-Mode to 1-Mode(s) 2.Compute transpose of I, I T ABCD A101 B011 C111 D101 A “groups by people” matrix A “people by groups” matrix

When we multiply matrices… Columns of first factor = rows of second factor (People x Groups) X (Groups x People) = (People x People) (Groups x People) X (People x Groups) = (Groups x Groups) I T I A GxG I T I A PxP =x = x

Degree

Mean(average) Degree

Degree and Edges

Adjacency Matrix

Matrix Arithmetic See also:

Directed Unweighted Undirected Weighted Undirected Unweighted Directed Weighted dichotomize symmetrize E A B C D E A B C D E A B C D E A B C D

Paths If there is a path from vertex A to vertex B… …then there is a sequence of edges connecting them E.g., if there is a 2-path from A to C then there is some vertex B such that there is an edge AB and an edge BC AC B Path A to C?

Put another way An edge from vertex j to vertex i means A ij =1 If there is a 2-path from j to i then there is a k such that A ik =1 and A kj =1. …i…j…k…  i  j  k  j i k

A ik =1 and A kj =1 That means: if there is a path from vertex j to vertex k to vertex i THEN there is a k such that A ik A kj =1 …i…j…k…  i  j  k  j i k a b c There is an edge from k to i There is an edge from j to k

Another way to see it… If vertex j is connected to vertex k AND Vertex I is connected to k THEN Row I will have a 1 in position k AND Column j will have a 1 in position k

Elements of Product Matrix are Vector Products = X i j A 2 ij is how many times the row version and the column version have 1s in the same place

…i…j…k…  i  j  k  Are there other paths from j to i? j i k

Look for vertices between j and i …i…j………  i  j    j i k

Example: Convert 2-Mode to 1-Mode(s) 2.Compute transpose of I, I T A 123 BDC ABCD

Degree Distribution “Distribution of X” = pattern of different values X takes on More specifically: the frequency of each value || 2 |||| ||| 3 |||| 4 |||| | 5 |||

Diagonal Elements of A 2 are Vertex Degree A= A2=A2=

Why? = A2A A X A Degree equals number of “out and back” paths of length 2

How about A 3 ? = A3A X A A2A2

What do these represent? = A3A X A A2A2

PRACTICE:COMPUTE A 2 FROM WXYZ W -100 TO X 0-11 Y 10-0 Z 0010 A W Z X Y FROM WXYZ W 0011 TO X 1010 Y 0100 Z 1000 A2A2

PRACTICE:COMPUTE A 3 FROM WXYZ W -100 TO X 0-11 Y 10-0 Z 0010 A W Z X Y FROM WXYZ W 0011 TO X 1010 Y 0100 Z 1000 A2A2 FROM WXYZ W 1010 TO X 1100 Y 0011 Z 0100 A3A3

…i…j…k…  i  j  k  Are there other paths from j to i? j i k