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)
“Family life is not a computer program that runs on its own; it needs continual input from everyone.”
—Neil Kurshan (20th century)
“The motive of science was the extension of man, on all sides, into Nature, till his hands should touch the stars, his eyes see through the earth, his ears understand the language of beast and bird, and the sense of the wind; and, through his sympathy, heaven and earth should talk with him. But that is not our science.”
—Ralph Waldo Emerson (18031882)