Representing Relations in a Graph
Graphs are another form of common data structure used in algorithms. You see
graphs used in places like maps for GPS and all sorts of other places where the top
down approach of a tree won’t work. The following sections describe graphs in
more detail.
Going beyond trees
A graph is a sort of a tree extension. As with trees, you have nodes that connect to
each other to create relationships. However, unlike binary trees, a graph can
have more than one or two connections. In fact, graph nodes often have a multi-
tude of connections. To keep things simple, though, consider the graph shown in
Figure 6-2.
CHAPTER 6
Do'stlaringiz bilan baham: |