In mathematics a graph is an abstract representation of a set of objects where some pairs of the objects are connected by links. The interconnected objects are represented by mathematical abstractions called vertices, and the links that connect some pairs of vertices are called edges. Typically, a graph is depicted in diagrammatic form as a set of dots for the vertices, joined by lines or curves for the edges.
For example, a graph may be constructed by choosing the vertices to be the first 1000 positive integers, and defining that there is an edge between two vertices if and only if those two integers have at least one decimal digit in common.
In other cases the relationship between vertices is not symmetric: for example, a graph may be constructed by choosing the vertices to be the first 1000 positive integers, and defining that there is an edge from i to j if i is a divisor of j. This type of graph is called a directed graph and the edges are called directed edges or arcs; in contast, a graph where the edges are not directed is called undirected.
Vertices are also called nodes or points, and edges are also called lines. Graphs are the basic subject studied by graph theory.
Contents |
Definitions in graph theory vary. The following are some of the more basic ways of defining graphs and related mathematical structures.
In the most common sense of the term,[1] a graph is an ordered pair comprising a set
of vertices or nodes together with a set
of edges or lines, which are 2-element subsets of
. To avoid ambiguity, this type of graph may be described precisely as undirected and simple.
Other senses of graph stem from different conceptions of the edge set. In one more generalized notion,[2] is a set together with a relation of incidence that associates with each edge two vertices. In another generalized notion,
is a multiset of unordered pairs of (not necessarily distinct) vertices. Many authors call this type of object a multigraph or pseudograph.
All of these variants and others are described more fully below.
The vertices belonging to an edge are called the ends, endpoints, or end vertices of the edge.
and
are usually taken to be finite, 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. The order of a graph is
(the number of vertices). A graph's size is
, the number of edges. The degree of a vertex is the number of edges that connect to it, where an edge that connects to the vertex at both ends (a loop) is counted twice.
The edges of an undirected graph
induce a symmetric binary relation ~ on
that is called the adjacency relation of
. Specifically, for each edge {u,v} the vertices u and v are said to be adjacent to one another, which is denoted u ~ v.
For an edge {u, v}, graph theorists usually use the somewhat shorter notation uv.
As stated above, in different contexts it may be useful to define the term graph with different degrees of generality. Whenever it is necessary to draw a strict distinction, the following terms are used. Most commonly, in modern texts in graph theory, unless stated otherwise, graph means "undirected simple finite graph" (see the definitions below).
A graph in which edges have no orientation, i.e., they are not ordered pairs, but sets {u, v} (or 2-multisets) of vertices.
A directed graph or digraph is an ordered pair with
An arc is considered to be directed from
to
;
is called the head and
is called the tail of the arc;
is said to be a direct successor of
, and
is said to be a direct predecessor of
. If a path leads from
to
, then
is said to be a successor of
and reachable from
, and
is said to be a predecessor of
. The arc
is called the arc
inverted.
A directed graph D is called symmetric if, for every arc in D, the corresponding inverted arc also belongs to D. A symmetric loopless directed graph D = (V, A) is equivalent to a simple undirected graph G = (V, E), where the pairs of inverse arcs in A correspond 1-to-1 with the edges in E; thus the edges in G number |E| = |A|/2, or half the number of arcs in D.
A variation on this definition is the oriented graph, in which not more than one of and
may be arcs.
A mixed graph G is a graph in which some edges may be directed and some may be undirected. It is written as an ordered triple G := (V, E, A) with V, E, and A defined as above. Directed and undirected graphs are special cases.
A loop is an edge (directed or undirected) which starts and ends on the same vertex; these may be permitted or not permitted according to the application. In this context, an edge with two different ends is called a link.
The term "multigraph" is generally understood to mean 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,[3] however, where graphs are defined so as to disallow loops and multiple edges, the term is often defined to mean a "graph" which can have both multiple edges and loops,[4] although many use the term "pseudograph" for this meaning.[5]
As opposed to a multigraph, a simple graph is an undirected graph that has no loops and no more than one edge between any two different vertices. In a simple graph the edges of the graph form a set (rather than a multiset) and each edge is a pair of distinct vertices. In a simple graph with n vertices every vertex has a degree that is less than n (the inverse, however, is not true - there exist non-simple graphs with n vertices in which every vertex has a degree smaller than n).
A graph is a weighted graph if a number (weight) is assigned to each edge. Such weights might represent, for example, costs, lengths or capacities, etc. depending on the problem.
The weight of the graph is sum of the weights given to all edges.
In exceptional situations it is even necessary to have edges with only one end, called half-edges, or no ends (loose edges); see for example signed graphs and biased graphs.
A regular graph is a graph where each vertex has the same number of neighbors, i.e., every vertex has the same degree or valency. A regular graph with vertices of degree k is called a k‑regular graph or regular graph of degree k.
Complete graphs have the feature that each pair of vertices has an edge connecting them.
A finite graph is a graph G = <V,E> such that V(G) and E(G) are finite sets. An infinite graph is the one with sets of vertices or edges or both infinite.
Most commonly in graph theory it is implied that the discussed graphs are finite, i.e., finite graphs are called simply "graphs", while the infinite graphs are called so in full.
In an undirected graph G, two vertices u and v are called connected if G contains a path from u to v. Otherwise, they are called disconnected. A graph is called connected if every pair of distinct vertices in the graph is connected and disconnected otherwise.
A graph is called k-vertex-connected or k-edge-connected if removal of k or more vertices (respectively, edges) makes the graph disconnected. A k-vertex-connected graph is often called simply k-connected.
A directed graph is called weakly connected if replacing all of its directed edges with undirected edges produces a connected (undirected) graph. It is strongly connected or strong if it contains a directed path from u to v and a directed path from v to u for every pair of vertices u,v.
Two edges of a graph are called adjacent (sometimes coincident) if they share a common vertex. Two arrows of a directed graph are called consecutive if the head of the first one is at the nock (notch end) of the second one. Similarly, two vertices are called adjacent if they share a common edge (consecutive if they are at the notch and at the head of an arrow), 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. 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). 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 unlabeled. (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.)
The picture is a graphic representation of the following graph
The fact that vertex 1 is adjacent to vertex 2 is sometimes denoted by 1 ~ 2.
Basic examples are:
More advanced kinds of graphs are:
There are several operations that produce new graphs from old ones, which might be classified into the following categories:
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.
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.
In computational biology, power graph analysis introduces power graphs as an alternative representation of undirected graphs.