# day22 - COP 3503 Computer Science II CLASS NOTES - DAY #22...

This preview shows pages 1–3. Sign up to view the full content.

COP 3503 – Computer Science II CLASS NOTES - DAY #22 In spite of the flexibility of trees and the many different tree applications, trees, by their very nature, have one limitation, namely, they can only represent relationships of a hierarchical type, such as the relation between a parent and child. Other relationships can only be represented indirectly, such as the relationship of being a sibling. In a tree there are no links between children of the same parent, thus the sibling relationship is determined only through the parent node. A graph, which is a generalization of a tree, does not have this limitation. Intuitively, a graph is a collection of vertices (nodes) and the connections (edges or arcs) between them. Generally, there are no restrictions imposed on the number of vertices in a graph nor on the number of connections one vertex can have to other vertices. Graphs are versatile data structures that can represent a large number of different situations and events from a rather diverse group of applications. Graph theory has grown into a sophisticated area of mathematics and computer science in the last two hundred years since it was first studied. We will look only very briefly at this data structure and restrict our focus to areas of interest to computer science. The picture below illustrates just four areas in which graphs and graph theory have applications ranging from simple graph traversal techniques to what can be very complex abstract machines known as FSA (finite state automata, also called FSM; finite state machines – see…there’s that discrete stuff again!). In the diagram below the portion labeled (a) shows how a graph can be used to determine the shortest distance between the airports in two different cities (so you can calculate your frequent flyer miles!). The diagram labeled (b) illustrates a graph modeling an electrical circuit where the vertices in the graph denote where the components are connected together with the edges representing the components themselves (e.g., resistors and capacitors). Using a graph you can answer questions such as “What are the mesh equations which describe the circuit’s behavior?” The diagram component labeled (c) shows how a logic circuit can be reduced to a graph. In this case the logic gates are represented by the vertices, and the arrows represent the signal propagation from gate outputs to gate inputs. Using a graph such as this you can answer questions of the form: “How long does it take for the signals to propagate from the inputs to the outputs?” or “Which gates are on the critical path?” Finally, the portion of the diagram labeled (d) represents a FSA with the vertices representing the states of the machine and the labeled arrows representing the allowable state transitions. Given such a graph representation of the FSA questions such as: “Are all the states reachable?” or “Can the FSA deadlock?” Day 22 - 1 Graphs

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Figure illustrating graph applications Definitions
This is the end of the preview. Sign up to access the rest of the document.

## This document was uploaded on 06/12/2011.

### Page1 / 9

day22 - COP 3503 Computer Science II CLASS NOTES - DAY #22...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online