A graph can refer to a graphic (such as a chart or diagram) showing or displaying the relationship between two or more variables used, for instance, in visualising scientific data.
In mathematics, a graph is an abstract representation of a set of objects where pairs of the objects can be connected by links. The interconnected objects are represented by mathematical abstractions called vertices, and the links that connect pairs of vertices are called edges. A graph is said undirected if the edges have no orientation. A graph is said directed if the edges are oriented. A graph is said weighted if there is a map from the set of the edges into a numeric set. Typically, a graph is depicted in diagrammatic form as a set of dots for the vertices, joined by lines or curves for the edges.
In computer science, a graph is an abstract data structure that is meant to implement the graph and hypergraph concepts from mathematics.
A graph data structure consists mainly of a finite (and possibly mutable) set of ordered pairs, called edges or arcs, of certain entities called nodes or vertices. As in mathematics, an edge
(x,y) is said to point or go from
y. The nodes may be part of the graph structure, or may be external entities represented by integer indices or references.