Application in Computer Science
The graph pictured above has this adjacency list representation: | ||
a | adjacent to | b,c |
b | adjacent to | a,c |
c | adjacent to | a,b |
In computer science, an adjacency list is a data structure for representing graphs. In an adjacency list representation, we keep, for each vertex in the graph, a list of all other vertices which it has an edge to (that vertex's "adjacency list"). For instance, the representation suggested by van Rossum, in which a hash table is used to associate each vertex with an array of adjacent vertices, can be seen as an example of this type of representation. Another example is the representation in Cormen et al. in which an array indexed by vertex numbers points to a singly linked list of the neighbors of each vertex.
One difficulty with the adjacency list structure is that it has no obvious place to store data associated with the edges of a graph, such as the lengths or costs of the edges. To remedy this, some texts, such as that of Goodrich and Tamassia, advocate a more object oriented variant of the adjacency list structure, sometimes called an incidence list, which stores for each vertex a list of objects representing the edges incident to that vertex. To complete the structure, each edge must point back to the two vertices forming its endpoints. The extra edge objects in this version of the adjacency list cause it to use more memory than the version in which adjacent vertices are listed directly, but these extra edges are also a convenient location to store additional information about each edge (e.g. their length).
Read more about this topic: Adjacency List
Famous quotes containing the words application, computer and/or science:
“The best political economy is the care and culture of men; for, in these crises, all are ruined except such as are proper individuals, capable of thought, and of new choice and the application of their talent to new labor.”
—Ralph Waldo Emerson (18031882)
“The computer takes up where psychoanalysis left off. It takes the ideas of a decentered self and makes it more concrete by modeling mind as a multiprocessing machine.”
—Sherry Turkle (b. 1948)
“Political liberty, the peace of a nation, and science itself are gifts for which Fate demands a heavy tax in blood!”
—HonorĂ© De Balzac (17991850)