7. Graphs and Trees
Graphs are used widely to model problems in many
different application areas.

Graph of major highway arteries in western Canada

Graphical representation of a city street system.

Graphical representation of a UNIX file system tree

Graph representation of a computer network

Graph representation of a software system

Flow graph notation for various constructs
Definition 7.1 (Graph)

A graph G = (V, E, f) consists of a nonempty set V
called nodes of the graph,
E is said to be the set of edges of the graph and f is a mapping from the edges
E to a set of ordered or unordered pairs of elements of V.
If an edge is mapped to an
ordered pair,
it is called a directed edge;
otherwise
it is called an undirected edge.
Definition 7.2 (Weighted Graph)

A graph in which weights are assigned to every edge
is called a
weighted graph.
Definition 7.3 (Isolated Node)

In a graph a node that is not adjacent to any other node
is called an isolated node.
Definition 7.4 (Digraph)

A graph G in which every edge is directed is called a digraph,
or directed graph.
Definition 7.5 (Outdegree, indegree)

In a digraph,
for any node v the number of edges that have v as
their initial node is called the outdegree of v.
The number of nodes that have v as their terminal node
is called the indegree of v.
The sum of outdegree and indegree of v
is called its total degree.
Definition 7.6 (Subgraph)

Let V(H) be the set of nodes of a graph H
and V(G) the set of nodes of a graph G such that
V(H) V(G).
If, in addition,
every edge of H is also an edge of G
then the Graph H is called a subgraph of the graph G,
which is expressed by writing H G.
Created by unroff & hptools.
© by HansPeter Bischof. All Rights Reserved (1998).
Last modified: 27/July/98 (12:14)