Jump to content

Graph (discrete mathematics): Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Lambyte (talk | contribs)
m too many hands
m compound modifier
 
(558 intermediate revisions by more than 100 users not shown)
Line 1: Line 1:
{{about|sets of vertices connected by edges|graphs of mathematical functions|Graph of a function|statistical graphs|Chart}}
{{about|sets of vertices connected by edges|graphs of mathematical functions|Graph of a function|other uses|Graph (disambiguation)}}
{{short description|Vertices connected in pairs by edges}}
{{further|Graph theory}}
[[File:6n-graf.svg|thumb|250px|A [[graph drawing|drawing]] of a [[labeled graph]] on 6 vertices and 7 edges.]]
[[File:6n-graf.svg|thumb|A graph with six vertices and seven edges]]


In [[mathematics]], a '''graph''' is a 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 ''[[Vertex (graph theory)|vertices]]'', and the links that connect some pairs of vertices are called ''edges''.<ref>{{cite book|last=Trudeau|first=Richard J.|title=Introduction to Graph Theory|year=1993|publisher=Dover Pub.|location=New York|isbn=978-0-486-67870-2|pages=19|url=http://store.doverpublications.com/0486678709.html|edition=Corrected, enlarged republication.|accessdate=8 August 2012|quote=A graph is an object consisting of two sets called its ''vertex set'' and its ''edge set''.}}</ref> Typically, a graph is depicted in diagrammatic form as a set of dots for the vertices, joined by lines or curves for the edges. Graphs are one of the objects of study in [[discrete mathematics]].
In [[discrete mathematics]], particularly in [[graph theory]], a '''graph''' is a structure consisting of a [[Set (mathematics)|set]] of objects where some pairs of the objects are in some sense "related". The objects are represented by abstractions called ''[[Vertex (graph theory)|vertices]]'' (also called ''nodes'' or ''points'') and each of the related pairs of vertices is called an ''edge'' (also called ''link'' or ''line'').<ref name=":0">{{cite book|last=Trudeau|first=Richard J.|title=Introduction to Graph Theory|year=1993|publisher=Dover Pub.|location=New York|isbn=978-0-486-67870-2|pages=19|url=http://store.doverpublications.com/0486678709.html|edition=Corrected, enlarged republication.|access-date=8 August 2012|quote=A graph is an object consisting of two sets called its ''vertex set'' and its ''edge set''.|archive-date=5 May 2019|archive-url=https://web.archive.org/web/20190505192352/http://store.doverpublications.com/0486678709.html|url-status=live}}</ref> Typically, a graph is depicted in [[diagrammatic form]] as a set of dots or circles for the vertices, joined by lines or curves for the edges.


The edges may be directed or undirected. For example, if the vertices represent people at a party, and there is an edge between two people if they shake hands, then this is an undirected graph, because if person A shook hands with person B, then person B also shook hands with person A. In contrast, if the vertices represent people at a party, and there is an edge from person A to person B when person A knows of person B, then this graph is directed, because knowledge of someone is not necessarily a [[symmetric relation]] (that is, one person knowing another person does not necessarily imply the reverse; for example, many fans may know of a celebrity, but the celebrity is unlikely to know of all their fans). This latter type of graph is called a ''directed'' graph and the edges are called ''directed edges'' or ''arcs''.
The edges may be directed or undirected. For example, if the vertices represent people at a party, and there is an edge between two people if they shake hands, then this graph is undirected because any person ''A'' can shake hands with a person ''B'' only if ''B'' also shakes hands with ''A''. In contrast, if an edge from a person ''A'' to a person ''B'' means that ''A'' owes money to ''B'', then this graph is directed, because owing money is not necessarily reciprocated.


Vertices are also called ''nodes'' or ''points'', and edges are also called ''lines'' or ''arcs''. Graphs are the basic subject studied by [[graph theory]]. The word "graph" was first used in this sense by [[James Joseph Sylvester|J.J. Sylvester]] in 1878.<ref>{{Cite book
Graphs are the basic subject studied by graph theory. The word "graph" was first used in this sense by [[James Joseph Sylvester|J. J. Sylvester]] in 1878 due to a direct relation between mathematics and [[chemical structure]] (what he called a chemico-graphical image).<ref>See:
* J. J. Sylvester (February 7, 1878) [https://books.google.com/books?id=KcoKAAAAYAAJ&q=Sylvester&pg=PA284 "Chemistry and algebra"], {{Webarchive|url=https://web.archive.org/web/20230204142956/https://books.google.com/books?id=KcoKAAAAYAAJ&vq=Sylvester&pg=PA284 |date=2023-02-04 }} ''Nature'', ''17'' : 284. {{doi|10.1038/017284a0}}. From page 284: "Every invariant and covariant thus becomes expressible by a ''graph'' precisely identical with a Kekuléan diagram or chemicograph."
* J. J. Sylvester (1878) [https://books.google.com/books?id=1q0EAAAAYAAJ&pg=PA64 "On an application of the new atomic theory to the graphical representation of the invariants and covariants of binary quantics, – with three appendices"], {{Webarchive|url=https://web.archive.org/web/20230204142957/https://books.google.com/books?id=1q0EAAAAYAAJ&pg=PA64 |date=2023-02-04 }} ''American Journal of Mathematics, Pure and Applied'', ''1'' (1) : 64–90. {{doi|10.2307/2369436}}. {{JSTOR|2369436}}. The term "graph" first appears in this paper on page 65.</ref><ref>{{Cite book
| title = Handbook of graph theory
| title = Handbook of graph theory
| first1 = Jonathan L.
| first1 = Jonathan L.
Line 15: Line 17:
| publisher = [[CRC Press]]
| publisher = [[CRC Press]]
| year = 2004
| year = 2004
| page = [http://books.google.com/books?id=mKkIGIea_BkC&pg=PA35&lpg=PA35 35]
| page = [https://books.google.com/books?id=mKkIGIea_BkC&pg=PA35 35]
| isbn = 978-1-58488-090-5
| isbn = 978-1-58488-090-5
| url = http://books.google.com/?id=mKkIGIea_BkC
| url = https://books.google.com/books?id=mKkIGIea_BkC
| postscript = <!--None-->}}</ref>
| access-date = 2016-02-16
| archive-date = 2023-02-04
| archive-url = https://web.archive.org/web/20230204142959/https://books.google.com/books?id=mKkIGIea_BkC
| url-status = live
}}</ref>


==Definitions==
== Definitions ==
Definitions in graph theory vary. The following are some of the more basic ways of defining graphs and related mathematical structures.
Definitions in graph theory vary. The following are some of the more basic ways of defining graphs and related [[mathematical structure]]s.


===Graph===
=== {{anchor|Undirected graph}} Graph ===
[[File:Multigraph.svg|thumb|125px|A general example of a graph (actually, a [[pseudograph]]) with three vertices and six edges.]]
[[File:Undirected.svg|thumb|upright|A graph with three vertices and three edges]]
In the most common sense of the term,<ref>See, for instance, Iyanaga and Kawada, '''69 J''', p. 234 or Biggs, p. 4.</ref> a '''graph''' is an [[ordered pair]] ''G''&nbsp;=&nbsp;(''V'',&nbsp;''E'') comprising a [[set (mathematics)|set]] ''V'' of '''vertices''' or '''nodes''' together with a set ''E'' of '''edges''' or '''lines''', which are 2-element subsets of ''V'' (i.e., an edge is related with two vertices, and the relation is represented as [[unordered pair]] of the vertices with respect to the particular edge). To avoid ambiguity, this type of graph may be described precisely as [[graph (mathematics)#Undirected graph|undirected]] and [[graph (mathematics)#Simple graph|simple]]'''.


Other senses of ''graph'' stem from different conceptions of the edge set. In one more generalized notion,<ref>See, for instance, Graham et al., p. 5.</ref> ''E'' is a set together with a relation of '''incidence''' that associates with each edge two vertices. In another generalized notion, ''E'' is a [[multiset]] of unordered pairs of (not necessarily distinct) vertices. Many authors call this type of object a [[multigraph]] or pseudograph.
A '''graph''' (sometimes called an ''undirected graph'' to distinguish it from a [[#Directed graph|directed graph]], or a ''simple graph'' to distinguish it from a [[multigraph]]){{sfn|Bender|Williamson|2010|p=148}}<ref>See, for instance, Iyanaga and Kawada, ''69 J'', p. 234 or Biggs, p. 4.</ref> is a [[ordered pair|pair]] {{math|1=''G'' = (''V'', ''E'')}}, where {{mvar|V}} is a set whose elements are called ''vertices'' (singular: vertex), and {{mvar|E}} is a set of unordered pairs <math>\{v_1, v_2\}</math> of vertices, whose elements are called ''edges'' (sometimes ''links'' or ''lines'').


The vertices {{mvar|u}} and {{mvar|v}} of an edge {{math|{''u'', ''v''} }} are called the edge's ''endpoints''. The edge is said to ''join'' {{mvar|u}} and {{mvar|v}} and to be ''incident'' on them. A vertex may belong to no edge, in which case it is not joined to any other vertex and is called ''isolated''. When an edge <math>\{u,v\}</math> exists, the vertices {{mvar|u}} and {{mvar|v}} are called ''adjacent''.
All of these variants and others are described more fully below.


A [[multigraph]] is a generalization that allows multiple edges to have the same pair of endpoints. In some texts, multigraphs are simply called graphs.{{sfn|Bender|Williamson|2010|p=149}}<ref>Graham et al., p. 5.</ref>
The vertices belonging to an edge are called the '''ends''', '''endpoints''', or '''end vertices''' of the edge. A vertex may exist in a graph and not belong to an edge.


Sometimes, graphs are allowed to contain ''[[Loop (graph theory)|loop]]s'', which are edges that join a vertex to itself. To allow loops, the pairs of vertices in {{mvar|E}} must be allowed to have the same node twice. Such generalized graphs are called ''graphs with loops'' or simply ''graphs'' when it is clear from the context that loops are allowed.
''V'' and ''E'' 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 graph|infinite case]]. The '''order''' of a graph is <math>|V|</math> (the number of vertices). A graph's '''size''' is <math>|E|</math>, 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 (graph theory)|loop]]) is counted twice.


Generally, the vertex set {{mvar|V}} is taken to be finite (which implies that the edge set {{mvar|E}} is also finite). Sometimes [[infinite graph]]s are considered, but they are usually viewed as a special kind of [[binary relation]], because most results on finite graphs either do not extend to the infinite case or need a rather different proof.
For an edge {''u'',&nbsp;''v''}, graph theorists usually use the somewhat shorter notation ''uv''.
{{-}}


An [[empty graph]] is a graph that has an [[empty set]] of vertices (and thus an empty set of edges). The ''order'' of a graph is its number {{math|{{abs|''V''}}}} of vertices, usually denoted by {{mvar|n}}. The ''size'' of a graph is its number {{math|{{abs|''E''}}}} of edges, typically denoted by {{mvar|m}}. However, in some contexts, such as for expressing the [[computational complexity]] of algorithms, the term ''size'' is used for the quantity {{math|{{abs|''V''}} + {{abs|''E''}}}} (otherwise, a non-empty graph could have size 0). The ''degree'' or ''valency'' of a vertex is the number of edges that are incident to it; for graphs with loops, a loop is counted twice.
===Adjacency relation===
The edges ''E'' of an undirected graph ''G'' induce a symmetric binary relation ~ on ''V'' that is called the '''adjacency''' relation of ''G''. Specifically, for each edge {''u'',&nbsp;''v''} the vertices ''u'' and ''v'' are said to be '''adjacent''' to one another, which is denoted ''u''&nbsp;~&nbsp;''v''.


In a graph of order {{math|''n''}}, the maximum degree of each vertex is {{math|''n'' − 1}} (or {{math|''n'' + 1}} if loops are allowed, because a loop contributes 2 to the degree), and the maximum number of edges is {{math|''n''(''n'' − 1)/2}} (or {{math|''n''(''n'' + 1)/2}} if loops are allowed).
==Types of graphs==
===Distinction in terms of the main definition===
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).


The edges of a graph define a [[symmetric relation]] on the vertices, called the ''adjacency relation''. Specifically, two vertices {{mvar|x}} and {{mvar|y}} are ''adjacent'' if {{math|{''x'', ''y''} }} is an edge. A graph is fully determined by its [[adjacency matrix]] {{mvar|A}}, which is an {{math|''n'' × ''n''}} square matrix, with {{mvar|A{{sub|ij}}}} specifying the number of connections from vertex {{mvar|i}} to vertex {{mvar|j}}. For a simple graph, {{math|''A{{sub|ij}}''}} is either 0, indicating disconnection, or 1, indicating connection; moreover {{math|1=''A{{sub|ii}}'' = 0}} because an edge in a simple graph cannot start and end at the same vertex. Graphs with self-loops will be characterized by some or all {{mvar|A{{sub|ii}}}} being equal to a positive integer, and multigraphs (with multiple edges between vertices) will be characterized by some or all {{mvar|A{{sub|ij}}}} being equal to a positive integer. Undirected graphs will have a [[symmetric matrix|symmetric]] adjacency matrix (meaning {{math|1=''A{{sub|ij}}'' = ''A{{sub|ji}}''}}).
{{multiple image
| right
| footer =
| width1 = 125
| image1 = Directed.svg
| caption1 = A directed graph.
| width2 = 125
| image2 = Undirected.svg
| caption2 = A [[Graph (mathematics)#Simple graph|simple]] undirected graph with three vertices and three edges. Each vertex has degree two, so this is also a regular graph.
}}


====Undirected graph====
=== Directed graph ===
{{main|Directed graph}}
[[File:Directed.svg|thumb|upright|A directed graph with three vertices and four directed edges, where the double arrow represents two directed edges in opposite directions]]


A '''directed graph''' or '''digraph''' is a graph in which edges have orientations.
An undirected graph is one in which edges have no orientation. The edge (a, b) is identical to the edge (b, a), i.e., they are not ordered pairs, but sets {''u'',&nbsp;''v''} (or 2-multisets) of vertices.


In one restricted but very common sense of the term,{{sfn|Bender|Williamson|2010|p=161}} a '''directed graph''' is a pair {{math|1=''G'' = (''V'', ''E'')}} comprising:
====Directed graph====
* {{mvar|V}}, a [[Set (mathematics)|set]] of ''vertices'' (also called ''nodes'' or ''points'');
{{main|Directed graph}}
* {{mvar|E}}, a [[Set (mathematics)|set]] of ''edges'' (also called ''directed edges'', ''directed links'', ''directed lines'', ''arrows'', or ''arcs''), which are [[ordered pair]]s of distinct vertices: <math>E \subseteq \{(x,y) \mid (x,y) \in V^2 \;\textrm{ and }\; x \neq y \}</math>.
A '''directed graph''' or '''digraph''' is an ordered pair ''D''&nbsp;=&nbsp;(''V'',&nbsp;''A'') with
To avoid ambiguity, this type of object may be called precisely a '''directed simple graph'''.
* ''V'' a [[set (mathematics)|set]] whose elements are called '''vertices''' or '''nodes''', and
* ''A'' a set of ordered pairs of vertices, called '''arcs''', '''directed edges''', or '''arrows'''.


An arc ''a''&nbsp;=&nbsp;(''x'',&nbsp;''y'') is considered to be directed '''from''' ''x'' '''to''' ''y''; ''y'' is called the '''head''' and ''x'' is called the '''tail''' of the arc; ''y'' is said to be a '''direct successor''' of ''x'', and ''x'' is said to be a '''direct predecessor''' of ''y''. If a [[path (graph theory)|path]] leads from ''x'' to ''y'', then ''y'' is said to be a '''successor''' of ''x'' and '''reachable''' from ''x'', and ''x'' is said to be a '''predecessor''' of ''y''. The arc (''y'',&nbsp;''x'') is called the arc (''x'',&nbsp;''y'') '''inverted'''.
In the edge {{math|(''x'', ''y'')}} directed from {{mvar|x}} to {{mvar|y}}, the vertices {{mvar|x}} and {{mvar|y}} are called the ''endpoints'' of the edge, {{mvar|x}} the ''tail'' of the edge and {{mvar|y}} the ''head'' of the edge. The edge is said to ''join'' {{mvar|x}} and {{mvar|y}} and to be ''incident'' on {{mvar|x}} and on {{mvar|y}}. A vertex may exist in a graph and not belong to an edge. The edge {{math|(''y'', ''x'')}} is called the ''inverted edge'' of {{math|(''x'', ''y'')}}. ''[[Multiple edges]]'', not allowed under the definition above, are two or more edges with both the same tail and the same head.


In one more general sense of the term allowing multiple edges,{{sfn|Bender|Williamson|2010|p=161}} a directed graph is sometimes defined to be an ordered triple {{math|1=''G'' = (''V'', ''E'', ''ϕ'')}} comprising:
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''&nbsp;=&nbsp;(''V'',&nbsp;''A'') is equivalent to a simple undirected graph ''G''&nbsp;=&nbsp;(''V'',&nbsp;''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''.
* {{mvar|V}}, a [[Set (mathematics)|set]] of ''vertices'' (also called ''nodes'' or ''points'');
* {{mvar|E}}, a [[Set (mathematics)|set]] of ''edges'' (also called ''directed edges'', ''directed links'', ''directed lines'', ''arrows'' or ''arcs'');
* {{mvar|ϕ}}, an ''incidence function'' mapping every edge to an [[ordered pair]] of vertices (that is, an edge is associated with two distinct vertices): <math>\phi : E \to \{(x,y) \mid (x,y) \in V^2 \;\textrm{ and }\; x \neq y \}</math>.


To avoid ambiguity, this type of object may be called precisely a '''directed multigraph'''.
A variation on this definition is the '''oriented graph''', in which at most one of (''x'',&nbsp;''y'') and (''y'',&nbsp;''x'') may be arcs.


A ''[[Loop (graph theory)|loop]]'' is an edge that joins a vertex to itself. Directed graphs as defined in the two definitions above cannot have loops, because a loop joining a vertex <math>x</math> to itself is the edge (for a directed simple graph) or is incident on (for a directed multigraph) <math>(x,x)</math> which is not in <math>\{(x,y) \mid (x,y) \in V^2 \;\textrm{ and }\; x \neq y \}</math>. So to allow loops the definitions must be expanded. For directed simple graphs, the definition of <math>E</math> should be modified to <math>E \subseteq \{(x,y) \mid (x,y) \in V^2 \}</math>. For directed multigraphs, the definition of <math>\phi</math> should be modified to <math>\phi : E \to \{(x,y) \mid (x,y) \in V^2 \}</math>. To avoid ambiguity, these types of objects may be called precisely a '''directed simple graph permitting loops''' and a '''directed multigraph permitting loops''' (or a ''[[Quiver (mathematics)|quiver]]'') respectively.
====Mixed graph====
{{main|Mixed graphs}}
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''&nbsp;=&nbsp;(''V'',&nbsp;''E'',&nbsp;''A'') with ''V'', ''E'', and ''A'' defined as above.
Directed and undirected graphs are special cases.


The edges of a directed simple graph permitting loops {{mvar|G}} is a [[Binary relation#Homogeneous relation|homogeneous relation]] ~ on the vertices of {{mvar|G}} that is called the ''adjacency relation'' of {{mvar|G}}. Specifically, for each edge {{math|(''x'', ''y'')}}, its endpoints {{mvar|x}} and {{mvar|y}} are said to be ''adjacent'' to one another, which is denoted {{math|''x'' ~ ''y''}}.
====Multigraph====
A [[loop (graph theory)|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'''.


=== Mixed graph ===
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,<ref>For example, see Balakrishnan, p. 1, Gross (2003), p. 4, and Zwillinger, p. 220.</ref> 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,<ref>For example, see. Bollobás, p. 7 and Diestel, p. 25.</ref> although many use the term "[[pseudograph]]" for this meaning.<ref>Gross (1998), p. 3, Gross (2003), p. 205, Harary, p.10, and Zwillinger, p. 220.</ref>
{{main|Mixed graph}}
[[File:Example of simple mixed graph.jpg|thumb|upright|A mixed graph with three vertices, two directed edges, and an undirected edge.]]


A ''mixed graph'' is a graph in which some edges may be directed and some may be undirected. It is an ordered triple {{math|1=''G'' = (''V'', ''E'', ''A'')}} for a ''mixed simple graph'' and {{math|1=''G'' = (''V'', ''E'', ''A'', ''ϕ{{sub|E}}'', ''ϕ{{sub|A}}'')}} for a ''mixed multigraph'' with {{mvar|V}}, {{mvar|E}} (the undirected edges), {{mvar|A}} (the directed edges), {{mvar|ϕ{{sub|E}}}} and {{mvar|ϕ{{sub|A}}}} defined as above. Directed and undirected graphs are special cases.
====Quiver====


=== Weighted graph ===
A '''[[Quiver (mathematics)|quiver]]''' or "multidigraph" is a directed graph which may have more than one arrow from a given source to a given target. A quiver may also have directed loops in it.
[[File:Weighted_network.svg|thumb|upright=1.2|A weighted graph with ten vertices and twelve edges]]


A ''weighted graph'' or a ''network''<ref>{{Citation | last=Strang | first=Gilbert | title=Linear Algebra and Its Applications | publisher=Brooks Cole | edition=4th | year=2005 | isbn=978-0-03-010567-8 }}</ref><ref>{{Citation | last=Lewis | first=John | title=Java Software Structures | publisher=Pearson | edition=4th | year=2013 | isbn=978-0133250121 | page=405 }}</ref> is a graph in which a number (the weight) is assigned to each edge.<ref>{{cite book|last1=Fletcher|first1=Peter|last2=Hoyle|first2=Hughes|last3=Patty|first3=C. Wayne|title=Foundations of Discrete Mathematics|year=1991|publisher=PWS-KENT Pub. Co.| location=Boston| isbn=978-0-53492-373-0| pages=463 | edition=International student|quote=A ''weighted graph'' is a graph in which a number ''w''(''e''), called its ''weight'', is assigned to each edge ''e''.}}</ref> Such weights might represent for example costs, lengths or capacities, depending on the problem at hand. Such graphs arise in many contexts, for example in [[shortest path problem]]s such as the [[traveling salesman problem]].
====Simple graph====
As opposed to a multigraph, a simple graph is an undirected graph that has no [[Loop (graph theory)|loops]] (edges connected at both ends to the same vertex) 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 ''distinct'' pair of vertices. In a simple graph with ''n'' vertices every vertex has a degree that is less than ''n'' (the converse, however, is not true&nbsp;— there exist non-simple graphs with ''n'' vertices in which every vertex has a degree smaller than ''n'').


== Types of graphs ==
====Weighted graph====
=== Oriented graph ===
A graph is a [[weighted graph]] if a number (weight) is assigned to each edge.<ref>{{cite book|last1=Fletcher|first1=Peter|last2=Hoyle|first2=Hughes|last3=Patty|first3=C. Wayne|title=Foundations of Discrete Mathematics|year=1991|publisher=PWS-KENT Pub. Co.| location=Boston| isbn=0-53492-373-9| pages=463 | edition=International student ed.|quote=A '''weighted graph''' is a graph in which a number ''w(e)'', called its '''weight''', is assigned to each edge ''e''.}}</ref> Such weights might represent, for example, costs, lengths or capacities, etc. depending on the problem at hand. Some authors call such a graph a network.<ref>{{Citation | last=Strang | first=Gilbert | title=Linear Algebra and Its Applications | publisher=Brooks Cole | edition=4th | year=2005 | isbn=0-03-010567-6 | url=http://books.google.com/books?vid=ISBN0030105676 }}</ref>
One definition of an ''oriented graph'' is that it is a directed graph in which at most one of {{nowrap|(''x'', ''y'')}} and {{nowrap|(''y'', ''x'')}} may be edges of the graph. That is, it is a directed graph that can be formed as an [[orientation (graph theory)|orientation]] of an undirected (simple) graph.


Some authors use "oriented graph" to mean the same as "directed graph". Some authors use "oriented graph" to mean any orientation of a given undirected graph or multigraph.
====Half-edges, loose 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 graph]]s and [[biased graph]]s.


===Important graph classes===
=== Regular graph ===
====Regular graph====
{{main|Regular graph}}
{{main|Regular graph}}
A regular graph is a graph where each vertex has the same number of neighbours, 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''.
A ''regular graph'' is a graph in which each vertex has the same number of neighbours, i.e., every vertex has the same degree. A regular graph with vertices of degree ''k'' is called a ''k''‑regular graph or regular graph of degree ''k''.


====Complete graph====
=== Complete graph ===
[[File:Complete graph K5.svg|thumb|125px|A complete graph with 5 vertices. Each vertex has an edge to every other vertex.]]
{{main|Complete graph}}
[[File:Complete graph K5.svg|thumb|upright|A complete graph with five vertices and ten edges. Each vertex has an edge to every other vertex.]]
{{Main|Complete graph}}
Complete graphs have the feature that each pair of vertices has an edge connecting them.


A ''complete graph'' is a graph in which each pair of vertices is joined by an edge. A complete graph contains all possible edges.
====Finite and infinite graphs====

A finite graph is a graph ''G''&nbsp;=&nbsp;(''V'',&nbsp;''E'') such that ''V'' and ''E'' are [[finite set]]s. An infinite graph is one with an [[Infinite set|infinite]] set of vertices or edges or both.
=== Finite graph ===
A ''finite graph'' is a graph in which the vertex set and the edge set are [[finite set]]s. Otherwise, it is called an ''infinite graph''.


Most commonly in graph theory it is implied that the graphs discussed are finite. If the graphs are infinite, that is usually specifically stated.
Most commonly in graph theory it is implied that the graphs discussed are finite. If the graphs are infinite, that is usually specifically stated.


=== Connected graph ===
====Graph classes in terms of connectivity====
{{main|Connectivity (graph theory)}}
{{main|Connectivity (graph theory)}}
In an undirected graph, an unordered pair of vertices {{nowrap|{{mset|''x'', ''y''}}}} is called ''connected'' if a path leads from ''x'' to ''y''. Otherwise, the unordered pair is called ''disconnected''.


In an undirected graph ''G'', two [[vertex (graph theory)|vertices]] ''u'' and ''v'' are called '''connected''' if ''G'' contains a [[Path (graph theory)|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; otherwise, it is called '''disconnected'''.
A ''connected graph'' is an undirected graph in which every unordered pair of vertices in the graph is connected. Otherwise, it is called a ''disconnected graph''.


In a directed graph, an ordered pair of vertices {{nowrap|(''x'', ''y'')}} is called ''strongly connected'' if a directed path leads from ''x'' to ''y''. Otherwise, the ordered pair is called ''weakly connected'' if an undirected path leads from ''x'' to ''y'' after replacing all of its directed edges with undirected edges. Otherwise, the ordered pair is called ''disconnected''.
A graph is called [[K-vertex-connected graph|'''''k''-vertex-connected''']] or [[k-edge-connected graph|'''''k''-edge-connected''']] if no set of ''k-1'' vertices (respectively, edges) exists that, when removed, disconnects the graph. 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'',&nbsp;''v''.
A ''strongly connected graph'' is a directed graph in which every ordered pair of vertices in the graph is strongly connected. Otherwise, it is called a ''weakly connected graph'' if every ordered pair of vertices in the graph is weakly connected. Otherwise it is called a ''disconnected graph''.


A ''[[k-vertex-connected graph]]'' or ''[[k-edge-connected graph]]'' is a graph in which no set of {{nowrap|''k'' − 1}} vertices (respectively, edges) exists that, when removed, disconnects the graph. A ''k''-vertex-connected graph is often called simply a ''k-connected graph''.
==Properties of graphs==
{{see also|Glossary of graph theory|Graph property}}


=== Bipartite graph ===
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'''.
{{main|Bipartite graph}}
A ''[[bipartite graph]]'' is a simple graph in which the vertex set can be [[Partition of a set|partitioned]] into two sets, ''W'' and ''X'', so that no two vertices in ''W'' share a common edge and no two vertices in ''X'' share a common edge. Alternatively, it is a graph with a [[chromatic number]] of 2.


In a [[complete bipartite graph]], the vertex set is the union of two disjoint sets, ''W'' and ''X'', so that every vertex in ''W'' is adjacent to every vertex in ''X'' but there are no edges within ''W'' or ''X''.
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 the terminology is not consistent and not all mathematicians allow this object.


=== Path graph ===
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 [[Shortest path problem|optimal routing problem]]s such as the [[traveling salesman problem]].
{{main|Path graph}}
A ''path graph'' or ''linear graph'' of order {{nowrap|''n'' ≥ 2}} is a graph in which the vertices can be listed in an order ''v''<sub>1</sub>, ''v''<sub>2</sub>, …, ''v''<sub>''n''</sub> such that the edges are the {{nowrap|{{mset|''v''<sub>''i''</sub>, ''v''<sub>''i''+1</sub>}}}} where ''i'' = 1, 2, …, ''n'' − 1. Path graphs can be characterized as connected graphs in which the degree of all but two vertices is 2 and the degree of the two remaining vertices is 1. If a path graph occurs as a [[Glossary of graph theory#Subgraphs|subgraph]] of another graph, it is a [[Path (graph theory)|path]] in that graph.


=== Planar graph ===
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 graphs with 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.)
{{main|Planar graph}}
A ''planar graph'' is a graph whose vertices and edges can be drawn in a plane such that no two of the edges intersect.


==Examples==
=== Cycle graph ===
{{main|Cycle graph}}
[[File:6n-graf.svg|thumb|A graph with six nodes.]]
A ''cycle graph'' or ''circular graph'' of order {{nowrap|''n'' ≥ 3}} is a graph in which the vertices can be listed in an order ''v''<sub>1</sub>, ''v''<sub>2</sub>, …, ''v''<sub>''n''</sub> such that the edges are the {{nowrap|{{mset|''v''<sub>''i''</sub>, ''v''<sub>''i''+1</sub>}}}} where ''i'' = 1, 2, …, ''n'' − 1, plus the edge {{nowrap|{{mset|''v''<sub>''n''</sub>, ''v''<sub>1</sub>}}}}. Cycle graphs can be characterized as connected graphs in which the degree of all vertices is 2. If a cycle graph occurs as a subgraph of another graph, it is a cycle or circuit in that graph.
* The diagram at right is a graphic representation of the following graph:
: ''V'' = {1, 2, 3, 4, 5, 6}
: ''E'' = {{1,&nbsp;2}, {1,&nbsp;5}, {2,&nbsp;3}, {2,&nbsp;5}, {3,&nbsp;4}, {4,&nbsp;5}, {4,&nbsp;6}}.
* In [[category theory]] a [[category (mathematics)|small category]] can be represented by a directed [[multigraph]] in which the objects of the category represented as vertices and the [[morphism]]s as directed edges. Then, the [[functor]]s between categories induce some, but not necessarily all, of the [[digraph morphism]]s of the graph.
* In [[computer science]], directed graphs are used to represent knowledge (e.g., [[Conceptual graph]]), [[finite state machine]]s, and many other discrete structures.
* A [[binary relation]] ''R'' on a set ''X'' defines a directed graph. An element ''x'' of ''X'' is a direct predecessor of an element ''y'' of ''X'' iff ''xRy''.


==Important graphs==
=== Tree ===
{{main|Tree (graph theory)}}
Basic examples are:
A ''tree'' is an undirected graph in which any two [[Vertex (graph theory)|vertices]] are connected by ''exactly one'' [[Path (graph theory)|path]], or equivalently a [[Connected graph|connected]] [[Cycle (graph theory)|acyclic]] undirected graph.
* In a [[complete graph]], each pair of vertices is joined by an edge; that is, the graph contains all possible edges.
* In a [[bipartite graph]], the vertex set can be [[Partition of a set|partitioned]] into two sets, ''W'' and ''X'', so that no two vertices in ''W'' are adjacent and no two vertices in ''X'' are adjacent. Alternatively, it is a graph with a [[chromatic number]] of 2.
* In a [[complete bipartite graph]], the vertex set is the union of two disjoint sets, ''W'' and ''X'', so that every vertex in ''W'' is adjacent to every vertex in ''X'' but there are no edges within ''W'' or ''X''.
* In a ''linear graph'' or [[path graph]] of length ''n'', the vertices can be listed in order, ''v''<sub>0</sub>, ''v''<sub>1</sub>, ..., ''v''<sub>n</sub>, so that the edges are ''v''<sub>i−1</sub>''v''<sub>i</sub> for each ''i'' = 1, 2, ..., ''n''. If a linear graph occurs as a [[Glossary of graph theory#Subgraphs|subgraph]] of another graph, it is a [[Path (graph theory)|path]] in that graph.
* In a [[cycle graph]] of length ''n ≥ 3'', vertices can be named ''v''<sub>1</sub>, ..., ''v''<sub>n</sub> so that the edges are ''v''<sub>i−1</sub>''v''<sub>''i''</sub> for each ''i'' = 2,...,''n'' in addition to ''v''<sub>n</sub>''v''<sub>1</sub>. Cycle graphs can be characterized as [[Connectivity (graph theory)|connected]] [[Regular graph|2-regular]] graphs. If a cycle graph occurs as a subgraph of another graph, it is a ''cycle'' or ''circuit'' in that graph.
* A [[planar graph]] is a graph whose vertices and edges can be drawn in a plane such that no two of the edges intersect (i.e., ''embedded'' in a plane).
* A [[tree (graph theory)|tree]] is a connected graph with no cycles.
* A ''forest'' is a graph with no cycles (i.e. the disjoint union of one or more ''trees'').


A ''forest'' is an undirected graph in which any two vertices are connected by ''at most one'' path, or equivalently an acyclic undirected graph, or equivalently a [[Disjoint union of graphs|disjoint union]] of trees.

=== Polytree ===
{{main|Polytree}}

A ''polytree'' (or ''directed tree'' or ''oriented tree'' or ''singly connected network'') is a [[directed acyclic graph]] (DAG) whose underlying undirected graph is a tree.

A ''polyforest'' (or ''directed forest'' or ''oriented forest'') is a directed acyclic graph whose underlying undirected graph is a forest.

=== Advanced classes ===
More advanced kinds of graphs are:
More advanced kinds of graphs are:
* The [[Petersen graph]] and its generalizations
* [[Petersen graph]] and its generalizations;
* [[Perfect graph]]s
* [[perfect graph]]s;
* [[Cograph]]s
* [[cograph]]s;
* [[Chordal graph]]s
* [[chordal graph]]s;
* Other graphs with large [[Graph automorphism|automorphism groups]]: [[Vertex-transitive graph|vertex-transitive]], [[Arc-transitive graph|arc-transitive]], and [[distance-transitive graph]]s.
* other graphs with large [[Graph automorphism|automorphism groups]]: [[Vertex-transitive graph|vertex-transitive]], [[Arc-transitive graph|arc-transitive]], and [[distance-transitive graph]]s;
* [[Strongly regular graph]]s and their generalization [[distance-regular graph]]s.
* [[strongly regular graph]]s and their generalizations [[distance-regular graph]]s.

== Properties of graphs ==
{{see also|Glossary of graph theory|Graph property}}
Two edges of a graph are called ''adjacent'' if they share a common vertex. Two edges of a directed graph are called ''consecutive'' if the head of the first one is the tail of the second one. Similarly, two vertices are called ''adjacent'' if they share a common edge (''consecutive'' if the first one is the tail and the second one is the head of an 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''. The graph with no vertices and no edges is sometimes called the ''[[null graph]]'' or ''empty graph'', but the terminology is not consistent and not all mathematicians allow this object.

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. (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 graphs with labeled edges are called ''edge-labeled''. 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''. (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 [[category theory|category]] of all graphs is the [[comma category]] Set ↓ ''D'' where ''D'': Set → Set is the [[functor]] taking a set ''s'' to ''s'' × ''s''.

== Examples ==
[[File:6n-graf.svg|thumb|A graph with six vertices and seven edges]]


* The diagram is a schematic representation of the graph with vertices <math>V = \{1, 2, 3, 4, 5, 6\}</math> and edges <math>E = \{\{1, 2\}, \{1, 5\}, \{2, 3\}, \{2, 5\}, \{3, 4\}, \{4, 5\}, \{4, 6\}\}.</math>
==Operations on graphs==
* In [[computer science]], directed graphs are used to represent knowledge (e.g., [[conceptual graph]]), [[finite-state machine]]s, and many other discrete structures.
{{main|Operations on graphs}}
* A [[binary relation]] ''R'' on a set ''X'' defines a directed graph. An element ''x'' of ''X'' is a direct predecessor of an element ''y'' of ''X'' if and only if ''xRy''.
* A directed graph can model information networks such as [[Twitter]], with one user following another.<ref name="snatwitter">{{Cite journal| volume = 3| issue = 1| last = Grandjean| first = Martin| title = A social network analysis of Twitter: Mapping the digital humanities community| journal = Cogent Arts & Humanities| date = 2016| pages = 1171458| doi = 10.1080/23311983.2016.1171458| url = https://serval.unil.ch/resource/serval:BIB_81C2C68B1DF5.P001/REF| doi-access = free| access-date = 2019-09-16| archive-date = 2021-03-02| archive-url = https://web.archive.org/web/20210302190117/https://serval.unil.ch/resource/serval:BIB_81C2C68B1DF5.P001/REF| url-status = live}}</ref><ref name="twitterwtf">Pankaj Gupta, Ashish Goel, Jimmy Lin, Aneesh Sharma, Dong Wang, and Reza Bosagh Zadeh [http://dl.acm.org/citation.cfm?id=2488433 WTF: The who-to-follow system at Twitter] {{Webarchive|url=https://web.archive.org/web/20190712002903/http://dl.acm.org/citation.cfm?id=2488433 |date=2019-07-12 }}, ''Proceedings of the 22nd international conference on World Wide Web''. {{doi|10.1145/2488388.2488433}}.</ref>
*Particularly regular examples of directed graphs are given by the [[Cayley graph]]s of finitely-generated groups, as well as [[Schreier coset graph]]s
*In [[category theory]], every [[small category]] has an underlying directed multigraph whose vertices are the objects of the category, and whose edges are the arrows of the category. In the language of category theory, one says that there is a [[forgetful functor]] from the [[category of small categories]] to the [[Quiver (mathematics)|category of quivers]].


There are several operations that produce new graphs from old ones, which might be classified into the following categories:
== Graph operations ==
{{main|Graph operations}}
There are several operations that produce new graphs from initial ones, which might be classified into the following categories:
* Elementary operations, sometimes called "editing operations" on graphs, which create a new graph from the original one by a simple, local change, such as addition or deletion of a vertex or an edge, merging and splitting of vertices, etc.
* ''unary operations'', which create a new graph from an initial one, such as:
** [[edge contraction]],
* [[graph rewriting|Graph rewrite operations]] replacing the occurrence of some pattern graph within the host graph by an instance of the corresponding replacement graph.
** [[line graph]],
* Unary operations, which create a significantly new graph from the old one. Examples:
** [[Line graph]]
** [[dual graph]],
** [[Dual graph]]
** [[complement graph]],
** [[Complement graph]]
** [[graph rewriting]];
* Binary operations, which create new graph from two initial graphs. Examples:
* ''binary operations'', which create a new graph from two initial ones, such as:
** [[Disjoint union of graphs]]
** [[disjoint union of graphs]],
** [[Cartesian product of graphs]]
** [[cartesian product of graphs]],
** [[Tensor product of graphs]]
** [[tensor product of graphs]],
** [[Strong product of graphs]]
** [[strong product of graphs]],
** [[Lexicographic product of graphs]]
** [[lexicographic product of graphs]],
** [[series–parallel graph]]s.


==Generalizations==
== Generalizations ==
In a [[hypergraph]], an edge can join more than two vertices.
In a [[hypergraph]], an edge can join any positive number of vertices.


An undirected graph can be seen as a [[simplicial complex]] consisting of 1-[[simplex|simplices]] (the edges) and 0-simplices (the vertices). As such, complexes are generalizations of graphs since they allow for higher-dimensional simplices.
An undirected graph can be seen as a [[simplicial complex]] consisting of 1-[[simplex|simplices]] (the edges) and 0-simplices (the vertices). As such, complexes are generalizations of graphs since they allow for higher-dimensional simplices.
Line 189: Line 206:
In [[geographic information systems]], [[geometric networks]] are closely modeled after graphs, and borrow many concepts from [[graph theory]] to perform spatial analysis on road networks or utility grids.
In [[geographic information systems]], [[geometric networks]] are closely modeled after graphs, and borrow many concepts from [[graph theory]] to perform spatial analysis on road networks or utility grids.


==See also==
== See also ==
* [[Dual graph]]
* [[Conceptual graph]]
* [[Glossary of graph theory]]
* [[Graph (abstract data type)]]
* [[Hypergraph]]
* [[Graph (data structure)]]
* [[Graph database]]
* [[Graph database]]
* [[Graph drawing]]
* [[Graph drawing]]
* [[List of publications in mathematics#Graph theory|Graph theory publications]]
* [[List of graph theory topics]]
* [[List of graph theory topics]]
* [[List of publications in mathematics#Graph theory|List of publications in graph theory]]
* [[Network theory]]
* [[Network theory]]
* [[Webgraph]]
* [[Conceptual graph]]
* [[Horizontal constraint graph]]
* [[Causal dynamical triangulation]]
* [[Sage Math]] (software)
* [[NetworkX]] (software)
* [[Mathematica]] (software)
*[[Graph Theory]]


==Notes==
== Notes ==
{{reflist}}
{{reflist|30em}}


==References==
== References ==
* {{cite book|last=Balakrishnan|first=V. K.|title=Graph Theory|publisher=McGraw-Hill|date=1997-02-01|edition=1st|isbn=0-07-005489-4}}
* {{cite book |last=Balakrishnan |first=V. K. |date=1997 |title=Graph Theory|publisher=McGraw-Hill |edition=1st|isbn=978-0-07-005489-9}}
* {{cite book |last1=Bang-Jensen |first1=J. |last2=Gutin |first2=G. |date=2000 |title=Digraphs: Theory, Algorithms and Applications |url=http://www.cs.rhul.ac.uk/books/dbook/ |publisher=Springer }}
* {{cite book|last=Berge|first=Claude|title=Théorie des graphes et ses applications|publisher=Collection Universitaire de Mathématiques, II|location=Dunod, Paris|year=1958|pages=viii+277|language=French|authorlink=Claude Berge}} Translation: {{cite book|publisher=Wiley|location=Dover, New York|year=2001|origyear=1962}}
* {{cite book |last1=Bender |first1=Edward A. |last2=Williamson |first2=S. Gill |date=2010 |title=Lists, Decisions and Graphs. With an Introduction to Probability |url=https://books.google.com/books?id=vaXv_yhefG8C }}
* {{cite book|last=Biggs|first=Norman|title=Algebraic Graph Theory|publisher=Cambridge University Press|year=1993|edition=2nd|isbn=0-521-45897-8}}
* {{cite book|last=Bollobás|first=Béla|title=Modern Graph Theory|publisher=Springer|date=2002-08-12|edition=1st|isbn=0-387-98488-7}}
* {{cite book |last=Berge |first=Claude |date=1958 |title=Théorie des graphes et ses applications |language=fr |location=Paris |publisher=Dunod }}
* {{cite book|last=Bang-Jensen|first=J.|coauthors=Gutin, G.|title=Digraphs: Theory, Algorithms and Applications|publisher=Springer|year=2000|url=http://www.cs.rhul.ac.uk/books/dbook/}}
* {{cite book |last=Biggs |first=Norman |date=1993 |title=Algebraic Graph Theory |edition=2nd |publisher=Cambridge University Press |isbn=978-0-521-45897-9 }}
* {{Cite book | last1=Diestel | first1=Reinhard | title=Graph Theory | url=http://diestel-graph-theory.com/GrTh.html | publisher=Springer-Verlag | location=Berlin, New York | edition=3rd | isbn=978-3-540-26183-4 | year=2005 | postscript=<!--None--> }}.
* {{cite book |last=Bollobás |first=Béla |date=2002 |title=Modern Graph Theory |edition=1st |publisher=Springer |isbn=978-0-387-98488-9 }}
* {{cite book |last=Diestel |first=Reinhard |date=2005 |title=Graph Theory |url=http://diestel-graph-theory.com/GrTh.html |edition=3rd |location=Berlin, New York |publisher=Springer-Verlag |isbn=978-3-540-26183-4 }}
* {{cite book|title=Handbook of Combinatorics|editor=Graham, R.L., Grötschel, M., and Lovász, L|publisher=MIT Press|year=1995|isbn=0-262-07169-X}}
* {{cite book|last=Gross|first=Jonathan L.|coauthors=Yellen, Jay|title=Graph Theory and Its Applications|publisher=CRC Press|date=1998-12-30|isbn=0-8493-3982-0}}
* {{cite book |last1=Graham |first1=R.L. |last2=Grötschel |first2=M. |last3=Lovász |first3=L. |date=1995 |title=Handbook of Combinatorics |publisher=MIT Press |isbn=978-0-262-07169-7 }}
* {{cite book|title=Handbook of Graph Theory|editor=Gross, Jonathan L., & Yellen, Jay|publisher=CRC|date=2003-12-29|isbn=1-58488-090-2}}
* {{cite book |last1=Gross |first1=Jonathan L. |last2=Yellen |first2=Jay |date=1998 |title=Graph Theory and Its Applications |publisher=CRC Press |isbn=978-0-8493-3982-0 }}
* {{cite book|last=Harary|first=Frank|title=Graph Theory|publisher=Addison Wesley Publishing Company|date=January 1995|isbn=0-201-41033-8}}
* {{cite book |last1=Gross |first1=Jonathan L. |last2=Yellen |first2=Jay |date=2003 |title=Handbook of Graph Theory |publisher=CRC |isbn=978-1-58488-090-5 }}
* {{cite book|last=Iyanaga|first=Shôkichi|coauthors=Kawada, Yukiyosi|title=Encyclopedic Dictionary of Mathematics|publisher=MIT Press|year=1977|isbn=0-262-09016-3}}
* {{cite book |last=Harary |first=Frank |date=1995 |title=Graph Theory |publisher=Addison Wesley Publishing Company |isbn=978-0-201-41033-4 }}
* {{cite book |last1=Iyanaga |first1=Shôkichi |last2=Kawada |first2=Yukiyosi |date=1977 |title=Encyclopedic Dictionary of Mathematics |url=https://archive.org/details/encyclopedicdict0000niho |publisher=MIT Press |isbn=978-0-262-09016-2 |url-access=registration }}
* {{cite book|last=Zwillinger|first=Daniel|title=CRC Standard Mathematical Tables and Formulae|publisher=Chapman & Hall/CRC|date=2002-11-27|edition=31st|isbn=1-58488-291-3}}
* {{cite book |last=Zwillinger |first=Daniel |date=2002 |title=CRC Standard Mathematical Tables and Formulae |edition=31st |publisher=Chapman & Hall/CRC |isbn=978-1-58488-291-6 }}


==Further reading==
== Further reading ==
*{{cite book|last=Trudeau|first=Richard J.|title=Introduction to Graph Theory|year=1993|publisher=[[Dover Publications]]|location=New York|isbn=978-0-486-67870-2|url=http://store.doverpublications.com/0486678709.html|edition=Corrected, enlarged republication.|accessdate=8 August 2012}}
* {{cite book|last=Trudeau|first=Richard J.|title=Introduction to Graph Theory|year=1993|publisher=[[Dover Publications]]|location=New York|isbn=978-0-486-67870-2|url=http://store.doverpublications.com/0486678709.html|edition=Corrected, enlarged republication.|access-date=8 August 2012}}


==External links==
== External links ==
{{Library resources box
* [http://www.gfredericks.com/main/sandbox/graphs A searchable database of small connected graphs]
|by=no
* [http://www.visualcomplexity.com VisualComplexity.com] — A visual exploration on mapping complex networks
|onlinebooks=no
|others=no
|about=yes
|label=Graph (mathematics)}}
* {{Commonscatinline}}
* {{MathWorld | urlname=Graph | title = Graph}}
* {{MathWorld | urlname=Graph | title = Graph}}
* [https://sourceforge.net/projects/igv-intelligent/ Intelligent Graph Visualizer] — IGV create and edit graph, automatically places graph, search shortest path (+coloring vertices), center, degree, eccentricity, etc.
* [http://code.google.com/p/vge2/ Visual Graph Editor 2] — VGE2 designed for quick and easy creation, editing and saving of graphs and analysis of problems connected with graphs.
* [http://gianlucacosta.info/software/graphsj/ GraphsJ] — GraphsJ is an open source didactic Java software which features an easy-to-use GUI and interactively solves step-by-step many graph problems. Extensible via its Java SDK.
* [http://graphclasses.org GraphClasses] — Information System on Graph Classes and their Inclusions.


{{DEFAULTSORT:Graph (Mathematics)}}
{{DEFAULTSORT:Graph (Discrete mathematics)}}
[[Category:Graph theory]]
[[Category:Graph theory]]
[[Category:Graph theory objects]]

Latest revision as of 15:58, 20 December 2024

A graph with six vertices and seven edges

In discrete mathematics, particularly in graph theory, a graph is a structure consisting of a set of objects where some pairs of the objects are in some sense "related". The objects are represented by abstractions called vertices (also called nodes or points) and each of the related pairs of vertices is called an edge (also called link or line).[1] Typically, a graph is depicted in diagrammatic form as a set of dots or circles for the vertices, joined by lines or curves for the edges.

The edges may be directed or undirected. For example, if the vertices represent people at a party, and there is an edge between two people if they shake hands, then this graph is undirected because any person A can shake hands with a person B only if B also shakes hands with A. In contrast, if an edge from a person A to a person B means that A owes money to B, then this graph is directed, because owing money is not necessarily reciprocated.

Graphs are the basic subject studied by graph theory. The word "graph" was first used in this sense by J. J. Sylvester in 1878 due to a direct relation between mathematics and chemical structure (what he called a chemico-graphical image).[2][3]

Definitions

[edit]

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

Graph

[edit]
A graph with three vertices and three edges

A graph (sometimes called an undirected graph to distinguish it from a directed graph, or a simple graph to distinguish it from a multigraph)[4][5] is a pair G = (V, E), where V is a set whose elements are called vertices (singular: vertex), and E is a set of unordered pairs of vertices, whose elements are called edges (sometimes links or lines).

The vertices u and v of an edge {u, v} are called the edge's endpoints. The edge is said to join u and v and to be incident on them. A vertex may belong to no edge, in which case it is not joined to any other vertex and is called isolated. When an edge exists, the vertices u and v are called adjacent.

A multigraph is a generalization that allows multiple edges to have the same pair of endpoints. In some texts, multigraphs are simply called graphs.[6][7]

Sometimes, graphs are allowed to contain loops, which are edges that join a vertex to itself. To allow loops, the pairs of vertices in E must be allowed to have the same node twice. Such generalized graphs are called graphs with loops or simply graphs when it is clear from the context that loops are allowed.

Generally, the vertex set V is taken to be finite (which implies that the edge set E is also finite). Sometimes infinite graphs are considered, but they are usually viewed as a special kind of binary relation, because most results on finite graphs either do not extend to the infinite case or need a rather different proof.

An empty graph is a graph that has an empty set of vertices (and thus an empty set of edges). The order of a graph is its number |V| of vertices, usually denoted by n. The size of a graph is its number |E| of edges, typically denoted by m. However, in some contexts, such as for expressing the computational complexity of algorithms, the term size is used for the quantity |V| + |E| (otherwise, a non-empty graph could have size 0). The degree or valency of a vertex is the number of edges that are incident to it; for graphs with loops, a loop is counted twice.

In a graph of order n, the maximum degree of each vertex is n − 1 (or n + 1 if loops are allowed, because a loop contributes 2 to the degree), and the maximum number of edges is n(n − 1)/2 (or n(n + 1)/2 if loops are allowed).

The edges of a graph define a symmetric relation on the vertices, called the adjacency relation. Specifically, two vertices x and y are adjacent if {x, y} is an edge. A graph is fully determined by its adjacency matrix A, which is an n × n square matrix, with Aij specifying the number of connections from vertex i to vertex j. For a simple graph, Aij is either 0, indicating disconnection, or 1, indicating connection; moreover Aii = 0 because an edge in a simple graph cannot start and end at the same vertex. Graphs with self-loops will be characterized by some or all Aii being equal to a positive integer, and multigraphs (with multiple edges between vertices) will be characterized by some or all Aij being equal to a positive integer. Undirected graphs will have a symmetric adjacency matrix (meaning Aij = Aji).

Directed graph

[edit]
A directed graph with three vertices and four directed edges, where the double arrow represents two directed edges in opposite directions

A directed graph or digraph is a graph in which edges have orientations.

In one restricted but very common sense of the term,[8] a directed graph is a pair G = (V, E) comprising:

  • V, a set of vertices (also called nodes or points);
  • E, a set of edges (also called directed edges, directed links, directed lines, arrows, or arcs), which are ordered pairs of distinct vertices: .

To avoid ambiguity, this type of object may be called precisely a directed simple graph.

In the edge (x, y) directed from x to y, the vertices x and y are called the endpoints of the edge, x the tail of the edge and y the head of the edge. The edge is said to join x and y and to be incident on x and on y. A vertex may exist in a graph and not belong to an edge. The edge (y, x) is called the inverted edge of (x, y). Multiple edges, not allowed under the definition above, are two or more edges with both the same tail and the same head.

In one more general sense of the term allowing multiple edges,[8] a directed graph is sometimes defined to be an ordered triple G = (V, E, ϕ) comprising:

  • V, a set of vertices (also called nodes or points);
  • E, a set of edges (also called directed edges, directed links, directed lines, arrows or arcs);
  • ϕ, an incidence function mapping every edge to an ordered pair of vertices (that is, an edge is associated with two distinct vertices): .

To avoid ambiguity, this type of object may be called precisely a directed multigraph.

A loop is an edge that joins a vertex to itself. Directed graphs as defined in the two definitions above cannot have loops, because a loop joining a vertex to itself is the edge (for a directed simple graph) or is incident on (for a directed multigraph) which is not in . So to allow loops the definitions must be expanded. For directed simple graphs, the definition of should be modified to . For directed multigraphs, the definition of should be modified to . To avoid ambiguity, these types of objects may be called precisely a directed simple graph permitting loops and a directed multigraph permitting loops (or a quiver) respectively.

The edges of a directed simple graph permitting loops G is a homogeneous relation ~ on the vertices of G that is called the adjacency relation of G. Specifically, for each edge (x, y), its endpoints x and y are said to be adjacent to one another, which is denoted x ~ y.

Mixed graph

[edit]
A mixed graph with three vertices, two directed edges, and an undirected edge.

A mixed graph is a graph in which some edges may be directed and some may be undirected. It is an ordered triple G = (V, E, A) for a mixed simple graph and G = (V, E, A, ϕE, ϕA) for a mixed multigraph with V, E (the undirected edges), A (the directed edges), ϕE and ϕA defined as above. Directed and undirected graphs are special cases.

Weighted graph

[edit]
A weighted graph with ten vertices and twelve edges

A weighted graph or a network[9][10] is a graph in which a number (the weight) is assigned to each edge.[11] Such weights might represent for example costs, lengths or capacities, depending on the problem at hand. Such graphs arise in many contexts, for example in shortest path problems such as the traveling salesman problem.

Types of graphs

[edit]

Oriented graph

[edit]

One definition of an oriented graph is that it is a directed graph in which at most one of (x, y) and (y, x) may be edges of the graph. That is, it is a directed graph that can be formed as an orientation of an undirected (simple) graph.

Some authors use "oriented graph" to mean the same as "directed graph". Some authors use "oriented graph" to mean any orientation of a given undirected graph or multigraph.

Regular graph

[edit]

A regular graph is a graph in which each vertex has the same number of neighbours, i.e., every vertex has the same degree. A regular graph with vertices of degree k is called a k‑regular graph or regular graph of degree k.

Complete graph

[edit]
A complete graph with five vertices and ten edges. Each vertex has an edge to every other vertex.

A complete graph is a graph in which each pair of vertices is joined by an edge. A complete graph contains all possible edges.

Finite graph

[edit]

A finite graph is a graph in which the vertex set and the edge set are finite sets. Otherwise, it is called an infinite graph.

Most commonly in graph theory it is implied that the graphs discussed are finite. If the graphs are infinite, that is usually specifically stated.

Connected graph

[edit]

In an undirected graph, an unordered pair of vertices {x, y} is called connected if a path leads from x to y. Otherwise, the unordered pair is called disconnected.

A connected graph is an undirected graph in which every unordered pair of vertices in the graph is connected. Otherwise, it is called a disconnected graph.

In a directed graph, an ordered pair of vertices (x, y) is called strongly connected if a directed path leads from x to y. Otherwise, the ordered pair is called weakly connected if an undirected path leads from x to y after replacing all of its directed edges with undirected edges. Otherwise, the ordered pair is called disconnected.

A strongly connected graph is a directed graph in which every ordered pair of vertices in the graph is strongly connected. Otherwise, it is called a weakly connected graph if every ordered pair of vertices in the graph is weakly connected. Otherwise it is called a disconnected graph.

A k-vertex-connected graph or k-edge-connected graph is a graph in which no set of k − 1 vertices (respectively, edges) exists that, when removed, disconnects the graph. A k-vertex-connected graph is often called simply a k-connected graph.

Bipartite graph

[edit]

A bipartite graph is a simple graph in which the vertex set can be partitioned into two sets, W and X, so that no two vertices in W share a common edge and no two vertices in X share a common edge. Alternatively, it is a graph with a chromatic number of 2.

In a complete bipartite graph, the vertex set is the union of two disjoint sets, W and X, so that every vertex in W is adjacent to every vertex in X but there are no edges within W or X.

Path graph

[edit]

A path graph or linear graph of order n ≥ 2 is a graph in which the vertices can be listed in an order v1, v2, …, vn such that the edges are the {vi, vi+1} where i = 1, 2, …, n − 1. Path graphs can be characterized as connected graphs in which the degree of all but two vertices is 2 and the degree of the two remaining vertices is 1. If a path graph occurs as a subgraph of another graph, it is a path in that graph.

Planar graph

[edit]

A planar graph is a graph whose vertices and edges can be drawn in a plane such that no two of the edges intersect.

Cycle graph

[edit]

A cycle graph or circular graph of order n ≥ 3 is a graph in which the vertices can be listed in an order v1, v2, …, vn such that the edges are the {vi, vi+1} where i = 1, 2, …, n − 1, plus the edge {vn, v1}. Cycle graphs can be characterized as connected graphs in which the degree of all vertices is 2. If a cycle graph occurs as a subgraph of another graph, it is a cycle or circuit in that graph.

Tree

[edit]

A tree is an undirected graph in which any two vertices are connected by exactly one path, or equivalently a connected acyclic undirected graph.

A forest is an undirected graph in which any two vertices are connected by at most one path, or equivalently an acyclic undirected graph, or equivalently a disjoint union of trees.

Polytree

[edit]

A polytree (or directed tree or oriented tree or singly connected network) is a directed acyclic graph (DAG) whose underlying undirected graph is a tree.

A polyforest (or directed forest or oriented forest) is a directed acyclic graph whose underlying undirected graph is a forest.

Advanced classes

[edit]

More advanced kinds of graphs are:

Properties of graphs

[edit]

Two edges of a graph are called adjacent if they share a common vertex. Two edges of a directed graph are called consecutive if the head of the first one is the tail of the second one. Similarly, two vertices are called adjacent if they share a common edge (consecutive if the first one is the tail and the second one is the head of an 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. The graph with no vertices and no edges is sometimes called the null graph or empty graph, but the terminology is not consistent and not all mathematicians allow this object.

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. (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 graphs with labeled edges are called edge-labeled. 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. (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 category of all graphs is the comma category Set ↓ D where D: Set → Set is the functor taking a set s to s × s.

Examples

[edit]
A graph with six vertices and seven edges
  • The diagram is a schematic representation of the graph with vertices and edges
  • In computer science, directed graphs are used to represent knowledge (e.g., conceptual graph), finite-state machines, and many other discrete structures.
  • A binary relation R on a set X defines a directed graph. An element x of X is a direct predecessor of an element y of X if and only if xRy.
  • A directed graph can model information networks such as Twitter, with one user following another.[12][13]
  • Particularly regular examples of directed graphs are given by the Cayley graphs of finitely-generated groups, as well as Schreier coset graphs
  • In category theory, every small category has an underlying directed multigraph whose vertices are the objects of the category, and whose edges are the arrows of the category. In the language of category theory, one says that there is a forgetful functor from the category of small categories to the category of quivers.

Graph operations

[edit]

There are several operations that produce new graphs from initial ones, which might be classified into the following categories:

Generalizations

[edit]

In a hypergraph, an edge can join any positive number of 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, see continuous graph.

In computational biology, power graph analysis introduces power graphs as an alternative representation of undirected graphs.

In geographic information systems, geometric networks are closely modeled after graphs, and borrow many concepts from graph theory to perform spatial analysis on road networks or utility grids.

See also

[edit]

Notes

[edit]
  1. ^ Trudeau, Richard J. (1993). Introduction to Graph Theory (Corrected, enlarged republication. ed.). New York: Dover Pub. p. 19. ISBN 978-0-486-67870-2. Archived from the original on 5 May 2019. Retrieved 8 August 2012. A graph is an object consisting of two sets called its vertex set and its edge set.
  2. ^ See:
  3. ^ Gross, Jonathan L.; Yellen, Jay (2004). Handbook of graph theory. CRC Press. p. 35. ISBN 978-1-58488-090-5. Archived from the original on 2023-02-04. Retrieved 2016-02-16.
  4. ^ Bender & Williamson 2010, p. 148.
  5. ^ See, for instance, Iyanaga and Kawada, 69 J, p. 234 or Biggs, p. 4.
  6. ^ Bender & Williamson 2010, p. 149.
  7. ^ Graham et al., p. 5.
  8. ^ a b Bender & Williamson 2010, p. 161.
  9. ^ Strang, Gilbert (2005), Linear Algebra and Its Applications (4th ed.), Brooks Cole, ISBN 978-0-03-010567-8
  10. ^ Lewis, John (2013), Java Software Structures (4th ed.), Pearson, p. 405, ISBN 978-0133250121
  11. ^ Fletcher, Peter; Hoyle, Hughes; Patty, C. Wayne (1991). Foundations of Discrete Mathematics (International student ed.). Boston: PWS-KENT Pub. Co. p. 463. ISBN 978-0-53492-373-0. A weighted graph is a graph in which a number w(e), called its weight, is assigned to each edge e.
  12. ^ Grandjean, Martin (2016). "A social network analysis of Twitter: Mapping the digital humanities community". Cogent Arts & Humanities. 3 (1): 1171458. doi:10.1080/23311983.2016.1171458. Archived from the original on 2021-03-02. Retrieved 2019-09-16.
  13. ^ Pankaj Gupta, Ashish Goel, Jimmy Lin, Aneesh Sharma, Dong Wang, and Reza Bosagh Zadeh WTF: The who-to-follow system at Twitter Archived 2019-07-12 at the Wayback Machine, Proceedings of the 22nd international conference on World Wide Web. doi:10.1145/2488388.2488433.

References

[edit]

Further reading

[edit]
[edit]