In computer science, a graph is an abstract data type (ADT) that consists of a set of nodes and a set of edges that establish relationships (connections) between the nodes. The graph ADT follows directly from the graph concept from mathematics.
A graph G is defined as follows: G=(V,E), where V is a finite, non-empty set of vertices and E is a set of edges (links between pairs of vertices). When the edges in a graph have no direction, the graph is called undirected, otherwise called directed. In practice, some information is associated with each node and edge.
In the general case, a graph may consist of many edges between many vertices, and unless the matrix representation for the edges is chosen, there may even be more than one edge connecting the same pair of vertices. Edges can be bidirectional or unidirectional.
Most data structures that are graphs are more structured than the general graph. A graph may, for example, be acyclic. In this case, each edge is unidirectional, and there is no way to traverse the edges in such a way as to ever visit the same node twice. An example of an acyclic graph is a directed acyclic word graph, a method of encoding a word-list for computer versions of word games such as Scrabble. A simple example of an acyclic graph is a non-circular singly linked list.
In most cases, the only information contained by the edge is that there is a relationship between the two nodes connected, and the information is stored in the node itself. However, some graphs have numerical values associated with each edge. These graphs can be used for different problems such as the Traveling salesman problem.
Additionally, there are graph-like structures where information is kept in the edges. One data structure has all of the information in the edges, and none of the information is in the nodes. This data structure can be very useful in modelling things like the pipes in a factory, or the wires in an airplane.
Graph theory | Data structures
Grafas (duomenų struktūra) | Граф (математика) | Graph (Graphentheorie) | Gráf (halmazelmélet) | Grafo | Grafas (matematika) | Graf (matematyka) | Граф (математика) | กราฟ (คณิตศาสตร์) | 图
This article is licensed under the GNU Free Documentation License.
It uses material from the
"Graph (data structure)".
Home Page • arts • business • computers • games • health • hospitals • home • kids & teens • news • physicians • recreation• reference • regional • science • shopping • society • sports • world