Graph Matrices

What?

  • A graph matrix is a square matrix with one row and one column for every node in the graph. 

  • The size of the matrix (i.e., the number of rows and columns) is equal to the number of nodes in the flow graph.

WHY?

  • The pictorial representation can be difficult to analyze as the size grows.

  • This is how we implement Graphs i.e. using Adjacency Matrix. Adjacency Lists can also be used.

Examples

Simple Graph

Pseudograph

Connection Matrix and Cyclomatic Complexity

How?

Power of Graph Matrix

Question

Given the flow graph.
 

  1. Find the Graph and Connection Matrix
     
  2. Find out the cyclomatic complexity
     
  3. Find two/three link paths from a node to any other node

Question

Given the flow graph.
 

  1. Find the Graph and Connection Matrix
     
  2. Find out the cyclomatic complexity
     
  3. Find two/three link paths from a node to any other node

Thank You

Graph Matrices

By Sahil Nishal

Graph Matrices

  • 287