# Graph (mathematics)

 The article below may contain errors of fact, bias, grammar, etc. The Citizendium Foundation and the participants in the Citizendium project make no representations about the reliability of this article or, generally, its suitability for any purpose. We make this disclaimer of all Citizendium article versions that have not been specifically approved.
This article presents the essential definitions. For a more complete account see graph theory. For another use of the term "graph" in mathematics, see graph of a function. For the more general concept of the graph of a relation, see relation.
Image:6n-graf.svg
A labeled graph on 6 vertices and 7 edges.

In mathematics and computer science, a graph is the basic object of study in graph theory. Informally speaking, a graph is a set of objects called points or vertices connected by links called lines or edges. In a graph proper, which is by default undirected, a line from point A to point B is considered to be the same thing as a line from point B to point A. In a digraph, short for directed graph, the two directions are counted as being distinct arcs or directed edges. Typically, a graph is depicted in diagrammatic form as a set of dots (for the points, vertices, or nodes), joined by curves (for the lines or edges).

## Definitions

Definitions in graph theory vary in the literature. The following are some of the more basic ways of defining graphs and related structures.

### Graph

A graph or undirected graph G is an ordered pair G := (V, E) that is subject to the following conditions:

• V is a set of vertices or nodes,
• E is a set of unordered pairs of distinct vertices, called edges or lines.
• The vertices belonging to an edge are called the ends, endpoints, or end vertices of the edge.

V (and hence E) are usually taken to be finite sets, and many of the well-known results are not true (or are rather different) for infinite graphs because many of the arguments fail in the infinite case.

### Directed graph

A directed graph or digraph G is an ordered pair G:=(V, A) with

• V, a set of vertices or nodes,
• A, a set of ordered pairs of vertices, called directed edges, arcs, or arrows. An edge e = (x, y) is considered to be directed from x to y; y is called the head and x is called the tail of the edge.

A variation on this definition is the oriented graph, which is a graph (or multigraph; see below) with an orientation or direction assigned to each of its edges. A distinction between a directed graph and an oriented simple graph is that if x and y are vertices, a directed graph allows both (x, y) and (y, x) as edges, while only one is permitted in an oriented graph. A more fundamental difference is that, in a directed graph (or multigraph), the directions are fixed, but in an oriented graph (or multigraph), only the underlying graph is fixed, while the orientation may vary.

A directed acyclic graph, also called a dag or DAG, is a directed graph with no directed cycles.

A quiver is sometimes said to be simply a directed graph, but in practice it is a directed graph with vector spaces attached to the vertices and linear transformations attached to the arcs.

### Mixed graph

A mixed graph G is an ordered triple G := (V,E,A) with V, E and A defined as above.

### Variations in the definitions

As defined above, edges of undirected graphs have two distinct ends, and E and A are sets (with distinct elements, like all sets). Many applications require more general possibilities, but terminology varies.

A loop is an edge (directed or undirected) with both ends the same; these may be permitted or not permitted according to the application. In this context, an edge with two different ends is called a link.

Sometimes E and A are allowed to be multisets, so that there can be more than one edge (called multiple edges) between the same two vertices. Another way to allow multiple edges is to make E a set, independent of V, and to specify the endpoints of an edge by an incidence relation between V and E. The same applies to a directed edge set A, except that there must be two incidence relations, one for the head and one for the tail of each edge.

A simple graph is always understood to mean a "graph" which contains no loops or multiple edges. However, the unqualified term "graph" might allow or disallow loops and multiple edges in the literature, according to the preferences of the author and the requirements of the particular topic.

The term "multigraph" is used to indicate that multiple edges (and sometimes loops) are allowed. Where graphs are defined so as to allow loops and multiple edges, a multigraph is often defined to mean a graph without loops, however, where graphs are defined so as to disallow loops and mutiple edges, the term is often defined to mean a "graph" which can have loops or multiple edges.

Sometimes the term "pseudograph" is used to indicate that both multiple edges and loops are allowed. In exceptional situations it is even necessary to have edges with only one end, called halfedges, or no ends (loose edges); see for example signed graphs.

## Properties of graphs

For more definitions see Glossary of graph theory.

Two edges of a graph are called adjacent (sometimes coincident) if they share a common vertex. Similarly, two vertices are called adjacent if they share a common edge, in which case the common edge is said to join the two vertices. An edge and a vertex on that edge are called incident.

The graph with only one vertex and no edges is called the trivial graph. A graph with only vertices and no edges is known as an edgeless graph, empty graph, or null graph (there is no consistency in the literature). The graph with no vertices and no edges is sometimes called the null graph or empty graph, but not all mathematicians allow this object.

In a weighted graph or digraph, each edge is associated with some value, variously called its cost, weight, length or other term depending on the application; such graphs arise in many contexts, for example in optimal routing problems such as the traveling salesman problem.

Normally, the vertices of a graph, by their nature as elements of a set, are distinguishable. This kind of graph may be called vertex-labeled. However, for many questions it is better to treat vertices as indistinguishable; then the graph may be called unlabeled. (Of course, the vertices may be still distinguishable by the properties of the graph itself, e.g., by the numbers of incident edges). If vertices are indistinguishable they may be distinguished by giving each vertex a label, hence the name vertex-labeled graph. The same remarks apply to edges, so that graphs which have labeled edges are called edge-labeled graphs. Graphs with labels attached to edges or vertices are more generally designated as labeled. Consequently, graphs in which vertices are indistinguishable and edges are indistinguishable are called unlabelled. (Note that in the literature the term labeled may apply to other kinds of labeling, besides that which serves only to distinguish different vertices or edges.)

## Examples

The picture is a graphic representation of the following graph

• V:={1,2,3,4,5,6}
• E:={{1,2},{1,5},{2,3},{2,5},{3,4},{4,5},{4,6}}

The fact that vertex 1 is adjacent to vertex 2 is sometimes denoted by 1 ~ 2.

• A binary relation R on a set X is a simple directed graph. Two edges x,y of X are connected by an arrow if xRy.

## Operations on graphs

There are several operations that produce new graphs from old ones.

## Generalizations

In a hypergraph, an edge can join more than two vertices.

An undirected graph can be seen as a simplicial complex consisting of 1-simplices (the edges) and 0-simplices (the vertices). As such, complexes are generalizations of graphs since they allow for higher-dimensional simplices.

Every graph gives rise to a matroid, but in general the graph cannot be recovered from its matroid, so matroids are not truly generalizations of graphs.

In model theory, a graph is just a structure. But in that case, there is no limitation on the number of edges: it can be any cardinal number.

Nota Bene. Material to be merged follows.

In mathematics and computer science, a graph is a generalization of the simple concept of a set of dots, called vertices or nodes, connected by links, edges or arcs. "Nodes" and "arcs" are old notation. Depending on the applications, edges may or may not have a direction; edges joining a vertex to itself may or may not be allowed, and vertices and/or edges may be assigned weights, i.e. numbers. If the edges have a direction associated with them (indicated by an arrow in the graphical representation) we have a directed graph.

Structures that can be represented as graphs are ubiquitous, and many problems of practical interest can be formulated as questions about certain graphs. For example, the link structure of Wikipedia could be represented by a directed graph: the vertices are the articles in Wikipedia, and there's a directed edge from article A to article B if and only if A contains a link to B. Directed graphs are also used to represent finite state machines. The development of algorithms to handle graphs is therefore of major interest in computer science: see graph algorithms.

To do: Add more pictures here.

Image:6n-graf.png
A graph with 6 vertices and 7 edges.

## History

See graph theory.

## Basic Formal Definitions

Definitions in graph theory vary in the literature. Here are the conventions used in this encyclopedia.

A directed graph (also called digraph or quiver) consists of

a set V of vertices, and
a set E of edges, and
maps s, t : EV, where s(e) is the source and t(e) is the target of the directed edge e.

An undirected graph (or graph for short) is given by

a set V of vertices,
a set E of edges,
a function w : EP(V) which associates to each edge a two- or one-element subset of V, interpreted as the endpoints of the edge.

In a weighted graph or digraph, an additional function E → R associates a value with each edge, which can be considered its "cost"; such graphs arise in optimal route problems such as the traveling salesman problem.

Normally, the vertices of a graph by their nature are undistinguishable. (Of course, they may be distinguishable by the properties of the graph itself, e.g., by the numbers of incident edges). Some branches of graph theory require to uniquely identify vertices. If each vertex is given a label, then the graph is said to be labelled graph. Consequently, graphs without labels on vertices are called unlabelled.

For more definitions, see Glossary of graph theory.

## Examples

Formal definition: V={1,2,3,4,5,6}, E={e1,e2,e3,e4,e5,e6,e7} and the function w(e1)={1,2}, w(e2)={2,3}, w(e3)={1,5}, w(e4)={2,5}, w(e5)={3,4}, w(e6)={4,5}, w(e7)={4,6}.

## Pictorial representation of graphs

Graphs are often represented pictorially as follows: draw a dot for every vertex, and for every edge draw an arc connecting its endpoints. If the graph is directed, indicate the endpoint of an edge by an arrow.

Note that this graphical representation (a layout) should not be confused with the graph itself (the abstract, non-graphical structure). Very different layouts can correspond to the same graph (see external link #2). All that matters is which vertices are connected to which others by how many edges.

There are different approaches to graph layout, and these are considered under a branch of graph theory termed as graph drawing.

## References

• Balakrishnan, V.K.; Graph Theory, McGraw-Hill; 1 edition (February 1, 1997)
• Bollobas, Bela; Modern Graph Theory, Springer; 1st edition (August 12, 2002).
• Diestel, Reinhard; Graph Theory, Springer; 2nd edition (February 18, 2000).
• Gross, Jonathon L, and Yellen, Jay; Graph Theory and Its Applications, Chapman & Hall/CRC; 2n edition (September 22, 2005).
• Gross, Jonathon L, and Yellen, Jay; (eds); Handbook of Graph Theory. CRC (December 29, 2003).
• Zwillinger, Daniel; CRC Standard Mathematical Tables and Formulae, Chapman & Hall/CRC; 31st edition (November 27, 2002).