Mastering Algorithms With C - Kyle Loudon [112]
Related Topics
Fibonacci heaps
Collections of heap-ordered trees. Fibonacci heaps are used sometimes in computing minimum spanning trees and finding single-source shortest paths (see Chapter 17).
k-ary heaps
Heaps built from trees with a branching factor of k. Although not as common as heaps that are binary trees, a k -ary heap may be worth considering for some problems.
Chapter 11. Graphs
Graphs are some of the most flexible data structures in computing. In fact, most other data structures can be represented as graphs, although representing them in this way is usually more complicated. Generally, graphs are used to model problems defined in terms of relationships or connections between objects. Objects in a graph may be tangible entities such as nodes in a network or islands in a river, but they need not be. Often objects are less concrete, such as states in a system or transactions in a database. The same is true for connections and relationships among the objects. Nodes in a network are physically connected, but the connections between states in a system may simply indicate a decision made to get from one state to the next. Whatever the case, graphs model many useful and interesting computational problems.
This chapter covers:
Graphs
Flexible data structures typically used to model problems defined in terms of relationships or connections between objects. Objects are represented by vertices , and the relationships or connections between the objects are represented by edges between the vertices.
Search methods
Techniques for visiting the vertices of a graph in a specific order. Generally, either breadth-first or depth-first searches are used. Many graph algorithms are based on these basic methods of systematically exploring a graph's vertices.
Some applications of graphs are:
Graph algorithms
Algorithms that solve problems modeled by graphs (see Chapter 16). Many graph algorithms solve problems related to connectivity and routing optimization. For example, Chapter 16 explores algorithms for computing minimum spanning trees, finding shortest paths, and solving the traveling-salesman problem.
Counting network hops (illustrated in this chapter)
Counting the smallest number of nodes that must be traversed from one node to reach other nodes in an internet. This information is useful in internets in which the most significant costs are directly related to the number of nodes traversed.
Topological sorting (illustrated in this chapter)
A linear ordering of vertices in a directed acyclic graph so that all edges go from left to right. One of the most common uses of topological sorting is in determining an acceptable order in which to carry out a number of tasks that depend on one another.
Graph coloring
A process in which we try to color the vertices of a graph so that no two vertices joined by an edge have the same color. Sometimes we are interested only in determining the minimum number of colors required to meet this criterion, which is called the graph's chromatic number .
Hamiltonian-cycle problems
Problems in which one works with hamiltonian cycles, paths that pass through every vertex in a graph exactly once before returning to the original vertex. The traveling-salesman problem (see Chapter 16) is a special case of hamiltonian-cycle problem. In the traveling-salesman problem, we look for the hamiltonian cycle with the minimum cost.
Clique problems
Problems in which one works with regions of a graph where every vertex is connected somehow to every other. Regions with this property are called cliques. Some clique problems focus on determining the largest clique that a graph contains. Other clique problems focus on determining whether a graph contains a clique of a certain size at all.
Conflict serializability
A significant aspect of database optimization. Rather than executing the instructions of transactions one transaction after another, database systems