A graph is a type of visual display that arises in several places in mathematics and statistics.
In statistics, graphs are a way to display data. Pie charts and bar charts are two common types of graphs used to help readers visually understand the content of a data set.
In mathematics, and especially in Combinatorics, a graph is an abstract object consisting of a number of points ("vertices") and lines ("edges") connecting those points, and is used to study networks and similar objects. For example, one could create a graph to represent human friendships: this graph has one vertex for each person, and an edge between every two people who are friends. According to the theory of six degrees of separation, any two vertices on this graph are connected by a path that goes along at most six edges!
In mathematical terms, a graph is a pair of two sets V (vertices) and E (edges), where E is a subset of Cartesian product . A graph is "directed" if the pairs are unordered and "undirected" if the pairs are ordered. Edges or vertices of graphs may be assigned additional information
Example 1: Vertices are American cities, edges are roads between them, and edges are labeled with the length of the road between cities. A computer given such graph will find the shortest path between any two cities.
Example 2: A graph might show correlations and relations between concepts.
Example 3: A bipartite graph is a graph whose vertices may be divided into two types, presented on left and right. It might show membership.
Pope Benedict XVI ↘ Rick Santorum → Catholic Mother Teresa ↗ Mitt Romney → Mormon Joseph Smith ↗ Barack Obama → President Christopher Hitchens → Atheist Joseph Stalin ↗
On the left side there are people, and on the right hand side there are attributes.
This bipartite graph models a function.
A planar graph is a graph that can be embedded in the plane (or a sphere) such that there are no crossings between edges. The graphs drawn in examples 2 and 3 are planar, but the graph in example 1 is not, since roads can intersect outside cities.