Section 5.1: Graphs and Their Representations

Abstract:

We are introduced to definitions of graphs, various kinds of graphs, characteristic features of graphs, and even a few theorems about graphs (for example, we learn when two graphs are the same, or isomorphic, even when they look strikingly different).

We then take a look at planar graphs (in particular at Euler's formula), and computer representations of graphs (adjacency matrices, adjacency lists).

Definitions

A graph is defined loosely as a set of nodes, and a set of arcs which connect some of the nodes.

More formally, we have the following

Definition: a graph is an ordered triple (N,A,g) where

displaymath353

x and y are the endpoints of the arc. g is a function tex2html_wrap_inline367 and tex2html_wrap_inline369 .

Example: Practice #1, p. 342/404.

Definition: a directed graph is an ordered triple (N,A,g) where

displaymath354

so g is a function tex2html_wrap_inline377 and tex2html_wrap_inline369 .

Example: Exercise #1, p. 361/423.

Examples of graphs in action (p. 344/405)

Graph Terminology

Take a moment to draw a graph - that is an object consistent with the above definition(s). Using the graph terminology handout to classify your graph. In particular the vocabulary we want to focus on is as follows:

Example: Exercise #2, p. 362/423.

Special Graphs

By tex2html_wrap_inline381 we will understand the simple, complete graph with n nodes.

Example: Exercise #5a, p. 362:/423 Draw tex2html_wrap_inline385 .

A bipartite complete graph tex2html_wrap_inline387 is a graph of N nodes which break into two groups, tex2html_wrap_inline391 and tex2html_wrap_inline393 , of size m and n respectively, with the property that two nodes x and y are adjacent tex2html_wrap_inline403 tex2html_wrap_inline405 and tex2html_wrap_inline407 .

Example: Exercise #5b, p. 362/423: Draw tex2html_wrap_inline409 .

Isomorphic Graphs

The idea of isomorphism is that two structures can be ``morphed'' into each other (they are in some sense identical, up to labelling). Our objective, in general, is to figure out the ``morphism'' (isomorphism - same form!).

Example: Look at Figure 5.17, p. 350/411: can you morph the two graphs together?

Definition: Two graphs tex2html_wrap_inline413 and tex2html_wrap_inline415 are isomorphic if there are bijections (one-to-one and onto mappings) tex2html_wrap_inline417 and tex2html_wrap_inline419 such that for each arc tex2html_wrap_inline421 ,

displaymath411

(replace braces by parentheses for a directed graph).

Example: Practice #7, p. 350/412. If you managed to morph the two graphs in Figure 5.17, then you should be able to ``see'' the rest of function tex2html_wrap_inline423 .

Theorem: Two simple graphs tex2html_wrap_inline413 and tex2html_wrap_inline415 are isomorphic if there is a bijection tex2html_wrap_inline429 such that for any nodes tex2html_wrap_inline431 and tex2html_wrap_inline433 of tex2html_wrap_inline391 , tex2html_wrap_inline431 and tex2html_wrap_inline433 are adjacent tex2html_wrap_inline403 tex2html_wrap_inline443 and tex2html_wrap_inline445 are adjacent.

Example: Exercise #11/15, p. 363/425.

Here are some tests for determining when two graphs are not isomorphic:

  1. The graphs don't have the same number of nodes.
  2. The graphs don't have the same number of arcs.
  3. One graph is connected and the other isn't.
  4. One graph has a node of degree k and the other doesn't.
  5. One graph has parallel arcs and the other doesn't.
  6. One graph has loops and the other doesn't.
  7. One graph has cycles and the other doesn't.
This list is not complete, however: sometimes things get trickier than this (as shown in Example 12, p. 351/413).

Example: Exercise #8/12, p. 362/425.

Planar Graphs

A planar graph is one which can be drawn in two-dimensions so that its arcs intersect only in nodes. ``Designers of integrated circuits want all components in one layer of a chip to form a planar graph so that no connections cross.'' (p. 352/413)

Example: Revisit #11/15, p. 363/425.

Euler's Formula for simple, connected planar graphs states that

displaymath449

where n is the number of nodes, a is the number of arcs, and r is the number of regions (including the infinite region surrounding the graph).

Think ``ran to'' to remember the formula....

Check out the author's proof of the theorem (p. 353/414): Hey! What's induction doing in here? Euler's formula is proven by induction, on a, the number of arcs, and a consideration of cases (node of degree 1; no node of degree 1).

Note: about Euler (Born: 15 April 1707 in Basel, Switzerland Died: 18 Sept 1783 in St Petersburg, Russia). He was so prolific that his work is still being compiled. He went blind in his old age, and became even more prolific! He was an incredible calculating machine.

Example: Revisit #11/15, p. 363/425., for a check.

The following theorem provides some estimates on the relationship between the number of arcs and nodes that a planar graph may possess:

Theorem: For a simple, connected, planar graph with n nodes and a arcs,

  1. If the planar representation divides the plane into r regions, then

    displaymath450

  2. If tex2html_wrap_inline471 , then

    displaymath451

  3. If tex2html_wrap_inline471 and there are no cycles of length 3, then

    displaymath452

From this theorem we can deduce that tex2html_wrap_inline475 is not planar, since it has 5 nodes, and 10 arcs, and tex2html_wrap_inline477 .

Also from this theorem we can deduce that tex2html_wrap_inline479 is not planar, since it has 6 nodes, and 9 arcs, and no cycles of length 3: tex2html_wrap_inline481 .

Example: Exercise #22/26, p. 365/427.

Computer Representations of Graphs

We want to examine two different representations of graphs by a computer:

A matrix is basically a spreadsheet: a rectangular data set of numbers indexed by rows and columns.

An adjacency matrix for a graph with N nodes is of size N by N, where the rows and columns of the matrix represent the vertices. If the graph is undirected, then the element tex2html_wrap_inline489 of the matrix is non-zero tex2html_wrap_inline403 nodes i and j are adjacent; if directed, then the element tex2html_wrap_inline489 of the matrix is non-zero tex2html_wrap_inline403 there is an arc from node i to node j.

In our textbook, the element of the matrix tex2html_wrap_inline505 , the number of arcs meeting the criteria above.

Example: Practice #16, p. 358/419.

For an undirected graph the adjacency matrix is symmetric (which means that we can reduce storage by about half); for a directed graph, the matrix may well be unsymmetric.

Let's look at a nice web page, with an example of a directed graph .

Example: Exercise #33/37, p. 366/428.

An adjacency list might be a better storage method for graphs with relatively few arcs: we effectively store only the non-zero entries of the adjacency matrix, in a linked list:

Example: Exercise #48/52, p. 367/429.

The redundancy in drawing the adjacency list for an undirected graph is evident. This is eliminated for a directed graph:

Example: Exercise #57/61, p. 367/430.



Wed Feb 27 18:51:17 EST 2008