A graph is a structure consisting of a collection of items in which certain pairs of the objects are in some way “connected” in mathematics, and more specifically in graph theory. Each of the connected pairs of vertices is termed an edge, and the objects correspond to mathematical abstractions called vertices (sometimes called nodes or points) (also called link or line). A graph is often portrayed as a group of dots or circles for the vertices, linked by lines or curves for the edges, in diagrammatic form. In discrete mathematics, graphs are one of the topics studied.

There are two types of edges: directed and undirected. If the vertices represent individuals at a party and there is an edge connecting two persons if they shake hands, the graph is undirected since any person A may only shake hands with a person B if B also shakes hands with A. If any edge from a person A to a person B corresponds to A owing money to B, on the other hand, this graph is directed, as owing money is not always reciprocated. The former is referred to as an undirected graph, whereas the later is referred to as a directed graph.

Graph theory is primarily concerned with graphs. J. J. Sylvester used the term “graph” in 1878 to describe a direct relationship between mathematics and chemical structure (what he called chemico-graphical image).

A graph (sometimes known as an undirected graph or a simple graph to distinguish it from a multigraph) is a pair G = (V, E), where V is a set whose components are called vertices (singular: vertex) and E is a set of paired vertices whose elements are called edges (sometimes links or lines).

The edge’s vertices x and y are referred to as the edge’s endpoints. The edge is said to be incident on x and y and to link x and y. If a vertex does not belong to any edge, it is not connected to any other vertex.

A multigraph is a generalization that permits the same pair of endpoints to appear on numerous edges. Multigraphs are referred to as graphs in certain books.

Loops, which are edges that connect a vertex to itself, are sometimes allowed in graphs. The above specification must be adjusted to support loops by defining edges as multisets of two vertices rather than two-sets. When it is evident from the context that loops are allowed, such generalized graphs are called graphs with loops or just graphs.

In general, the set of vertices V is assumed to be limited, implying that the set of edges is finite as well. Most conclusions on finite graphs do not generalize to the infinite case, or require a different proof. Infinite graphs are sometimes explored, but are more typically treated as a specific form of binary connection.