Recent from talks
Nothing was collected or created yet.
Cycle (graph theory)
View on Wikipedia
In graph theory, a cycle in a graph is a non-empty trail in which only the first and last vertices are equal. A directed cycle in a directed graph is a non-empty directed trail in which only the first and last vertices are equal.
A graph without cycles is called an acyclic graph. A directed graph without directed cycles is called a directed acyclic graph. A connected graph without cycles is called a tree.
Definitions
[edit]Circuit and cycle
[edit]- Let G = (V, E, Φ) be a graph. A circuit is a non-empty trail (e1, e2, ..., en) with a vertex sequence (v1, v2, ..., vn, v1).
- A cycle or simple circuit is a circuit in which only the first and last vertices are equal.[1]
- n is called the length of the circuit resp. length of the cycle.
Directed circuit and directed cycle
[edit]- A directed circuit is a non-empty directed trail in which the first and last vertices are equal (closed directed trail).[1]
- Let G = (V, E, Φ) be a directed graph. A directed circuit is a non-empty directed trail (e1, e2, ..., en) with a vertex sequence (v1, v2, ..., vn, v1).
- A directed cycle or simple directed circuit is a directed circuit in which only the first and last vertices are equal.[1]
- n is called the length of the directed circuit resp. length of the directed cycle.
Chordless cycle
[edit]
A chordless cycle in a graph, also called a hole or an induced cycle, is a cycle such that no two vertices of the cycle are connected by an edge that does not itself belong to the cycle. An antihole is the complement of a graph hole. Chordless cycles may be used to characterize perfect graphs: by the strong perfect graph theorem, a graph is perfect if and only if none of its holes or antiholes have an odd number of vertices that is greater than three. A chordal graph, a special type of perfect graph, has no holes of any size greater than three.
The girth of a graph is the length of its shortest cycle; this cycle is necessarily chordless. Cages are defined as the smallest regular graphs with given combinations of degree and girth.
A peripheral cycle is a cycle in a graph with the property that every two edges not on the cycle can be connected by a path whose interior vertices avoid the cycle. In a graph that is not formed by adding one edge to a cycle, a peripheral cycle must be an induced cycle.
Cycle space
[edit]The term cycle may also refer to an element of the cycle space of a graph. There are many cycle spaces, one for each coefficient field or ring. The most common is the binary cycle space (usually called simply the cycle space), which consists of the edge sets that have even degree at every vertex; it forms a vector space over the two-element field. By Veblen's theorem, every element of the cycle space may be formed as an edge-disjoint union of simple cycles. A cycle basis of the graph is a set of simple cycles that forms a basis of the cycle space.[2]
Using ideas from algebraic topology, the binary cycle space generalizes to vector spaces or modules over other rings such as the integers, rational or real numbers, etc.[3]
Cycle detection
[edit]The existence of a cycle in directed and undirected graphs can be determined by whether a depth-first search (DFS) finds an edge that points to an ancestor of the current vertex (i.e., it contains a back edge).[4] All the back edges which DFS skips over are part of cycles.[5] In an undirected graph, the edge to the parent of a node should not be counted as a back edge, but finding any other already visited vertex will indicate a back edge. In the case of undirected graphs, only O(n) time is required to find a cycle in an n-vertex graph, since at most n − 1 edges can be tree edges.
Many topological sorting algorithms will detect cycles too, since those are obstacles for topological order to exist. Also, if a directed graph has been divided into strongly connected components, cycles only exist within the components and not between them, since cycles are strongly connected.[5]
For directed graphs, distributed message-based algorithms can be used. These algorithms rely on the idea that a message sent by a vertex in a cycle will come back to itself. Distributed cycle detection algorithms are useful for processing large-scale graphs using a distributed graph processing system on a computer cluster (or supercomputer).
Applications of cycle detection include the use of wait-for graphs to detect deadlocks in concurrent systems.[6]
Algorithm
[edit]The aforementioned use of depth-first search to find a cycle can be described as follows:
For every vertex v: visited(v) = finished(v) = false For every vertex v: DFS(v)
where
DFS(v) =
if finished(v): return
if visited(v):
"Cycle found"
return
visited(v) = true
for every neighbour w: DFS(w)
finished(v) = true
For undirected graphs, "neighbour" means all vertices connected to v, except for the one that recursively called DFS(v). This omission prevents the algorithm from finding a trivial cycle of the form v→w→v; these exist in every undirected graph with at least one edge.
A variant using breadth-first search instead will find a cycle of the smallest possible length.
Covering graphs by cycle
[edit]In his 1736 paper on the Seven Bridges of Königsberg,[7] widely considered to be the birth of graph theory,[8][9] Leonhard Euler proved that, for a finite undirected graph to have a closed walk that visits each edge exactly once (making it a closed trail), it is necessary and sufficient that it be connected except for isolated vertices (that is, all edges are contained in one component) and have even degree at each vertex.[7] The corresponding characterization for the existence of a closed walk visiting each edge exactly once in a directed graph is that the graph be strongly connected and have equal numbers of incoming and outgoing edges at each vertex. In either case, the resulting closed trail is known as an Eulerian trail. If a finite undirected graph has even degree at each of its vertices, regardless of whether it is connected, then it is possible to find a set of simple cycles that together cover each edge exactly once: this is Veblen's theorem.[10] When a connected graph does not meet the conditions of Euler's theorem, a closed walk of minimum length covering each edge at least once can nevertheless be found in polynomial time by solving the route inspection problem.
The problem of finding a single simple cycle that covers each vertex exactly once, rather than covering the edges, is much harder. Such a cycle is known as a Hamiltonian cycle, and determining whether it exists is NP-complete.[11] Much research has been published concerning classes of graphs that can be guaranteed to contain Hamiltonian cycles; one example is Ore's theorem that a Hamiltonian cycle can always be found in a graph for which every non-adjacent pair of vertices have degrees summing to at least the total number of vertices in the graph.[12]
The cycle double cover conjecture states that, for every bridgeless graph, there exists a multiset of simple cycles that covers each edge of the graph exactly twice. Proving that this is true (or finding a counterexample) remains an open problem.[13]
Graph classes defined by cycle
[edit]Several important classes of graphs can be defined by or characterized by their cycles. These include:
- Bipartite graph, a graph without odd cycles (cycles with an odd number of vertices)
- Cactus graph, a graph in which every nontrivial biconnected component is a cycle
- Cycle graph, a graph that consists of a single cycle
- Chordal graph, a graph in which every induced cycle is a triangle
- Directed acyclic graph, a directed graph with no directed cycles
- Forest, a cycle-free graph
- Line perfect graph, a graph in which every odd cycle is a triangle
- Perfect graph, a graph with no induced cycles or their complements of odd length greater than three
- Pseudoforest, a graph in which each connected component has at most one cycle
- Strangulated graph, a graph in which every peripheral cycle is a triangle
- Strongly connected graph, a directed graph in which every edge is part of a cycle
- Triangle-free graph, a graph without three-vertex cycles
- Even-cycle-free graph, a graph without even cycles
- Even-hole-free graph, a graph without even cycles of length larger or equal to 6
See also
[edit]- Cycle space
- Cycle basis
- Cycle detection in a sequence of iterated function values
- Minimum mean weight cycle
References
[edit]- ^ a b c d Bender & Williamson 2010, p. 164.
- ^ Gross, Jonathan L.; Yellen, Jay (2005), "4.6 Graphs and Vector Spaces", Graph Theory and Its Applications (2nd ed.), CRC Press, pp. 197–207, ISBN 9781584885054, archived from the original on 2023-02-04, retrieved 2016-09-27.
- ^ Diestel, Reinhard (2012), "1.9 Some linear algebra", Graph Theory, Graduate Texts in Mathematics, vol. 173, Springer, pp. 23–28, archived from the original on 2023-02-04, retrieved 2016-09-27.
- ^ Tucker, Alan (2006). "Chapter 2: Covering Circuits and Graph Colorings". Applied Combinatorics (5th ed.). Hoboken: John Wiley & sons. p. 49. ISBN 978-0-471-73507-6.
- ^ a b Sedgewick, Robert (1983), "Graph algorithms", Algorithms, Addison–Wesley, ISBN 0-201-06672-6
- ^ Silberschatz, Abraham; Peter Galvin; Greg Gagne (2003). Operating System Concepts. John Wiley & Sons, INC. pp. 260. ISBN 0-471-25060-0.
- ^ a b Euler, Leonhard (1741). "Solutio problematis ad geometriam situs pertinentis". Commentarii Academiae Scientiarum Petropolitanae (in Latin). 8: 128-140 + Plate VIII. Translated into English as Solution of a problem in the geometry of position, Michael Behrend.
- ^ Räz, Tim (2018). "Euler's Königsberg: The explanatory power of mathematics" (PDF). European Journal for Philosophy of Science. 8 (3): 331–346. doi:10.1007/s13194-017-0189-x. S2CID 125194454.
Arguably, the fact that Euler's paper stands at the beginnings of graph theory is its most important innovation.
- ^ Shields, Rob (2012). "Cultural Topology: The Seven Bridges of Königsburg 1736". Theory, Culture & Society. 29 (4–5): 43–57. doi:10.1177/0263276412451161. S2CID 146875675.
- ^ Veblen, Oswald (1912), "An Application of Modular Equations in Analysis Situs", Annals of Mathematics, Second Series, 14 (1): 86–94, doi:10.2307/1967604, JSTOR 1967604.
- ^ Richard M. Karp (1972), "Reducibility Among Combinatorial Problems" (PDF), in R. E. Miller and J. W. Thatcher (ed.), Complexity of Computer Computations, New York: Plenum, pp. 85–103, archived (PDF) from the original on 2021-02-10, retrieved 2014-03-12
{{citation}}: CS1 maint: publisher location (link). - ^ Ore, Ø. (1960), "Note on Hamilton circuits", American Mathematical Monthly, 67 (1): 55, doi:10.2307/2308928, JSTOR 2308928.
- ^ Jaeger, F. (1985), "A survey of the cycle double cover conjecture", Annals of Discrete Mathematics 27 – Cycles in Graphs, North-Holland Mathematics Studies, vol. 27, pp. 1–12, doi:10.1016/S0304-0208(08)72993-1, ISBN 978-0-444-87803-8.
- Balakrishnan, V. K. (2005). Schaum's outline of theory and problems of graph theory ([Nachdr.] ed.). McGraw–Hill. ISBN 978-0070054899.
- Bender, Edward A.; Williamson, S. Gill (2010). Lists, Decisions and Graphs. With an Introduction to Probability.
Cycle (graph theory)
View on GrokipediaDefinitions and Variants
Undirected Cycles and Circuits
In undirected graphs, a walk is a finite sequence of vertices and edges , where each edge connects vertices and , and vertices and edges may repeat.[1] A trail is a walk with no repeated edges, while a path is a trail with no repeated vertices (except possibly the endpoints if considering closed variants, though typically paths are open).[1] A circuit is a closed trail, meaning it starts and ends at the same vertex and has no repeated edges, but vertices other than the start and end may repeat.[1][5] A cycle is a closed path, defined as a circuit in which no vertices are repeated except the starting and ending vertex, ensuring no repeated vertices or edges overall.[1][5] This distinguishes cycles from more general circuits, which permit repeated internal vertices as long as edges remain distinct; cycles thus represent the simplest form of closed structures without redundancy in vertices.[1] For example, in the complete graph —a triangle formed by three vertices each connected by an edge—the sequence of all three vertices and their edges forms the smallest possible cycle of length 3.[6] Formally, a cycle of length is denoted as the sequence , where the vertices are distinct and the edges are distinct, with each incident to and (and to and ).[1]Directed Cycles
In directed graphs, also known as digraphs, the concepts of walks, trails, paths, and circuits are adapted to account for the orientation of edges, referred to as arcs. A directed walk is a finite non-null sequence of vertices and arcs , where each arc has tail and head for .[7] A directed trail is a directed walk with no repeated arcs.[7] A directed path is a directed trail with no repeated vertices.[7] A directed circuit is a closed directed trail, that is, a directed trail in which the initial and terminal vertices coincide.[7] A directed cycle is a directed circuit in which no vertex is repeated except the initial and terminal ones, which are the same; it must contain at least one arc.[7] This distinguishes it from a directed circuit, which permits repeated vertices (other than the endpoints) as long as no arc is repeated.[7] Formally, a directed cycle can be denoted as a sequence of distinct vertices (with ) such that there are directed arcs from to for , and from to .[7] A simple example of a directed cycle is a directed triangle in a tournament graph, where three vertices are connected by arcs , , and , forming a cyclic orientation without any transitive relations among them.[7] In the context of digraph connectivity, a strongly connected component with more than one vertex necessarily contains at least one directed cycle, as mutual reachability implies cyclic paths.[7]Structural Properties
Chordless Cycles
In graph theory, a chord of a cycle is an edge that connects two non-consecutive vertices of the cycle.[8] A chordless cycle, also known as an induced cycle, is a cycle that contains no such chords, meaning the subgraph induced by its vertices consists solely of the cycle edges.[9] When the length of the cycle is at least four, it is often specifically termed a hole. Chordless cycles possess the property of being minimal induced subgraphs that form cycles, as any additional edge within the vertex set would introduce a chord or alter the induced structure.[9] For instance, the cycle graph , consisting of four vertices connected in a square, is a chordless cycle, but adding a diagonal edge between opposite vertices introduces a chord, rendering the original cycle no longer induced.[8] Chordless cycles of length greater than three play a key role in the theory of perfect graphs, where their absence characterizes chordal graphs, a subclass of perfect graphs.[10] By definition, every non-chordal graph contains a chordless cycle of length at least four.[10]Cycle Length and Girth
The length of a cycle in an undirected graph is defined as the number of edges it contains, which equals the number of vertices since the cycle returns to its starting point.[11] This measure captures the size of the cycle as a closed path without repeated vertices except the endpoints. The girth of a graph is the length of its shortest cycle, formally given by or if contains no cycles (i.e., if is acyclic).[12] This parameter quantifies the local cyclicity of the graph, with smaller values indicating the presence of short cycles like triangles. For example, trees, which are connected acyclic graphs, have infinite girth by definition.[12] In contrast, the complete graph for has girth 3, as every triple of vertices forms a triangle, the shortest possible cycle.[12] The distribution of cycle lengths in a graph depends on its density and connectivity. In dense graphs, characterized by a high proportion of edges relative to the number of vertices (e.g., average degree ), short cycles predominate due to the abundance of local connections, while longer cycles—up to lengths approaching the order of the graph—also occur, often forming consecutive sequences from the girth onward when the minimum degree is sufficiently large.[13] This contrasts with sparse graphs, where cycles, if present, tend to be longer and sparser in distribution. The girth provides insight into edge density constraints. Graphs with large girth must be sparse, as excessive edges tend to create short cycles; for instance, graphs with girth at least 5 have at most edges, by the Kővári–Sós–Turán theorem.[14] The Moore bound formalizes this for regular graphs, giving an upper limit on the number of vertices for a given degree and girth , such as for odd , with equality achieved only in rare cases like the complete graph for .[15] This bound highlights how high girth restricts growth in vertex count for fixed degree, linking cycle shortness to overall graph expansion.Algebraic Structure
Cycle Space
In graph theory, the cycle space of an undirected graph is defined as the vector space over the binary field whose elements are the subsets of edges that form even-degree subgraphs, also known as Eulerian subgraphs.[16] These subgraphs are precisely those where every vertex has even degree in the induced subgraph.[7] Vector addition in this space is performed via the symmetric difference of edge sets, which corresponds to addition modulo 2 on the characteristic vectors of the edge subsets.[16] The cycle space is generated by the simple cycles of the graph, meaning every even-degree subgraph can be expressed as a -linear combination of simple cycles.[16] Thus, the simple cycles serve as generating elements, and the symmetric difference of any two cycles yields another element of the space, such as a disjoint union of cycles or a more complex even subgraph.[7] The dimension of the cycle space is given by , where is the number of edges, is the number of vertices, and is the number of connected components of .[7] This formula arises from the fact that the rank of the incidence matrix of over is , making the nullity (dimension of the kernel, which is the cycle space) equal to ; this is a consequence of Kirchhoff's matrix-tree theorem extended to the binary field.[16] For example, in a cycle graph with vertices and edges, which is connected (), the dimension is , and the cycle space is spanned by the single generator consisting of all edges of the full cycle.[7]Basis and Dimension of Cycle Space
In the cycle space of a graph with edges, vertices, and connected components over , a basis consists of linearly independent cycles, known as the cyclomatic number of . This set of cycles generates the entire space under symmetric difference, and any larger set is linearly dependent.[17] A standard way to construct such a basis uses fundamental cycles derived from a spanning forest of . For a connected graph, select a spanning tree ; each of the edges not in (chords) defines a unique fundamental cycle by adding that edge to , forming the unique cycle in the subgraph induced by union the chord. In the general case with components, a spanning forest has edges, and each of the remaining edges closes a unique cycle with the unique path in connecting its endpoints, yielding a basis of fundamental cycles.[18] The dimension formula arises from linear algebra applied to the incidence matrix of . Consider the incidence matrix over , where rows correspond to vertices and columns to edges, with entries indicating the endpoints modulo 2. The cycle space is the kernel of , as cycles correspond to edge subsets with even degree at every vertex. The rank of equals , since the row space has corank (one dependency per component), so by the rank-nullity theorem, the nullity (dimension of the cycle space) is . For example, the complete graph has , , and , so the cycle space dimension is . A spanning tree with 3 edges leaves 3 chords, each defining a fundamental cycle (e.g., triangles sharing edges), forming a basis. These three 3-cycles generate all even subgraphs, including the symmetric difference yielding the outer 4-cycle. The cycle space is orthogonal to the cut space (bond space) in the edge space over , meaning their intersection is trivial and their dimensions sum to ; every cycle meets every cut evenly. This duality underpins many algebraic results in graph theory.[18]Detection and Computation
Cycle Detection Algorithms
Cycle detection in graphs is a fundamental problem that determines whether a graph contains one or more cycles. In undirected graphs, the presence of a cycle can be efficiently detected using depth-first search (DFS) by identifying back edges, which are edges connecting a vertex to one of its ancestors in the DFS tree.[19] The algorithm proceeds by performing a DFS traversal starting from an arbitrary vertex, maintaining a visited array to track explored nodes and a parent array to record the traversal path. During the traversal, for each adjacent vertex of the current node, if the adjacent vertex is unvisited, it is recursively visited with the current node as its parent; if it is visited and not the parent of the current node, a back edge is detected, confirming the existence of a cycle. This process is repeated for all unvisited vertices to handle disconnected components. The time complexity of this DFS-based approach is O(n + m), where n is the number of vertices and m is the number of edges, as it traverses each vertex and edge exactly once.[19] Here is pseudocode for cycle detection in an undirected graph using DFS:boolean hasCycle(Graph G) {
boolean[] visited = new boolean[G.n];
int[] parent = new int[G.n]; // Initialize to -1
for (int v = 0; v < G.n; v++) {
if (!visited[v]) {
if (DFS(G, v, visited, parent)) {
return true;
}
}
}
return false;
}
boolean DFS(Graph G, int u, boolean[] visited, int[] parent) {
visited[u] = true;
for (int v : G.adj[u]) {
if (!visited[v]) {
parent[v] = u;
if (DFS(G, v, visited, parent)) {
return true;
}
} else if (v != parent[u]) {
return true; // Back edge
}
}
return false;
}
boolean hasCycle(Graph G) {
boolean[] visited = new boolean[G.n];
int[] parent = new int[G.n]; // Initialize to -1
for (int v = 0; v < G.n; v++) {
if (!visited[v]) {
if (DFS(G, v, visited, parent)) {
return true;
}
}
}
return false;
}
boolean DFS(Graph G, int u, boolean[] visited, int[] parent) {
visited[u] = true;
for (int v : G.adj[u]) {
if (!visited[v]) {
parent[v] = u;
if (DFS(G, v, visited, parent)) {
return true;
}
} else if (v != parent[u]) {
return true; // Back edge
}
}
return false;
}