Г.Марусик. Дискр. математ. Метод. указ. к практическим занятиям

📚 Г.Марусик. Дискр. математ. Метод. указ. к практическим занятиям.pdf

Brief overview

This document serves as a guide for practical exercises in discrete mathematics. It covers foundational algebraic concepts, the principles of logic and Boolean functions, and a comprehensive introduction to graph theory, equipping students with essential problem-solving tools.

Key points

  • Overview of algebraic systems including sets, operations, vectors, and functions.
  • Exploration of logic algebra, Boolean functions, minimization techniques, and circuit synthesis.
  • Introduction to graph theory concepts and algorithms across three parts.
  • Analysis of graph properties such as connectivity, trees, and planar graphs.
  • Methods for solving problems involving shortest paths, networks, and Hamiltonian paths.

1. Algebraic systems: sets and operations

1.1 Sets and subsets

  • A set is a collection of distinct objects.
  • Objects in a set are called elements.
  • The empty set, denoted by or {} , contains no elements.
  • Example: The set {{5,6,7}, 8, } has three elements: the set {5,6,7}, the number 8, and the empty set .

1.1.1 Set notation and membership

  • Elements are listed within curly braces {}.
  • x ∈ A means "x is an element of set A".
  • x ∉ A means "x is not an element of set A".
  • Example: For A=x∈Z∣(x−3)(x2−1)=0andx≥0A = {x ∈ Z | (x-3)(x^2-1) = 0 and x ≥ 0}, the elements are non-negative integer roots of the equation. Thus, A = {1, 3}.

1.1.2 Subset relationships

  • A set A is a subset of set B, denoted A ⊆ B, if every element of A is also an element of B.
  • The empty set is a subset of every set.
  • Example:  ⊆  is true, but  ∈  is false because the empty set is not an element of itself. 3.

A ⊆ B if and only if for all x, if x ∈ A, then x ∈ B.

1.1.3 Power set

  • The power set of a set B, denoted ρ(B), is the set of all subsets of B.
  • If a set B has n elements, its power set ρ(B) has 2n2^n elements.
  • Example: For B = {0, 1}:
    • |B| = 2
    • ρ(B) = {, {0}, {1}, {0, 1}}
    • |ρ(B)| = 2^2 = 4
    • ρ(ρ(B)) has 24=162^4 = 16 elements.

1.1.4 Cardinality

  • The cardinality of a finite set, denoted |B| or Card B, is the number of elements in the set.
  • Example: For A = {(x,y) ∈ N × N | x + 3y = 2001}, where y = 667 - x/3, if x = 3k, then y = 667 - k. With 0≤k≤6670 ≤ k ≤ 667, there are 668 pairs. Thus, |A| = 668.

1.2 Operations on sets

  • Union (A ∪ B): The set of all elements that are in A, or in B, or in both.
  • Intersection (A ∩ B): The set of all elements that are in both A and B.
  • Difference (A \ B): The set of all elements that are in A but not in B.
  • Complement (A' or U \ A): The set of all elements in the universal set U that are not in A.

1.2.1 Examples of set operations

  • Example: Given A = (-1, 2] and B = [1, 4) with U = R.

    • A ∪ B = (-1, 4)
    • A ∩ B = 1 2.
    • A \ B = (-1, 1)
    • B \ A = (2, 4)
    • A′=(−∞,−1∪(2,∞)A' = (-∞, -1 ∪ (2, ∞).
  • Example: Find ∩_{n∈N} A_n and ∪_{n∈N} A_n for A_n = {1, 1/2, ..., 1/n}.

    • ∩_{n∈N} A_n = {1}
    • ∪_{n∈N} A_n = {1, 1/2, 1/3,...} 5.

1.2.2 Properties of set operations

  • Set operations follow distributive, associative, and commutative laws.
  • Example: (S ∪ T) \ R ≡ (S \ R) ∪ (T \ R) 7.
  • This means that if an element x is in the union of S and T but not in R, then x is either in S but not R, or in T but not R.

(S∪T)∖R=(S∖R)∪(T∖R)(S \cup T) \setminus R = (S \setminus R) \cup (T \setminus R)

1.3 Cartesian product

  • The Cartesian product of two sets A and B, denoted A × B, is the set of all ordered pairs (a, b) where a ∈ A and b ∈ B.
  • Example: If A = {1, 2} and B = {a, b}, then A × B = {(1, a), (1, b), (2, a), (2, b)}. 4 8.
  • Property: E × (F ∪ G) = (E × F) ∪ (E × G) 20 6.

1.3.1 Properties of Cartesian product

  • The Cartesian product is not generally commutative: A × B ≠ B × A.
  • It is distributive over union: A × (B ∪ C) = (A × B) ∪ (A × C).
  • It is also distributive over intersection: A × (B ∩ C) = (A × B) ∩ (A × C) 16.

E×(F∪G)=(E×F)∪(E×G)E \times (F \cup G) = (E \times F) \cup (E \times G)

1.4 Relations and Functions

1.4.1 Relations

  • A relation R from set A to set B is any subset of the Cartesian product A × B.
  • If A = B, the relation is on set A.
  • Example: On M = {Коля, Саша, Вера}, the relation "is a brother of" R = {(Коля, Вера), (Коля, Саша), (Саша, Вера), (Саша, Коля)}. 12.

1.4.2 Properties of relations

  • Properties include:
    • Reflexive: For all a ∈ A, (a, a) ∈ R.
    • Symmetric: If (a, b) ∈ R, then (b, a) ∈ R.
    • Antisymmetric: If (a, b) ∈ R and (b, a) ∈ R, then a = b.
    • Transitive: If (a, b) ∈ R and (b, c) ∈ R, then (a, c) ∈ R.
  • Example: On M = {2, 4, 8, 16}, the relation "a divides b" is reflexive, antisymmetric, and transitive 13.

1.4.3 Correspondences and Functions

  • A correspondence H between sets A and B is a subset of A × B.
  • The domain of H (denoted pr1(H)) is the set of all first elements of the pairs in H.
  • The range of H (denoted pr2(H)) is the set of all second elements of the pairs in H.
  • A correspondence is everywhere defined if its domain is the entire set A.
  • A correspondence is surjective if its range is the entire set B.

1.4.4 Types of functions

  • A correspondence is functional if each element in the domain corresponds to exactly one element in the range.
  • A correspondence is injective (one-to-one) if each element in the range corresponds to exactly one element in the domain.
  • A bijective correspondence is both functional and surjective.
  • Example: For A = {0, 1, 4} and B=(−∞,+∞)B = (-∞, +∞) with y = x^2. This correspondence is functional and injective but not surjective. 10.

A function f:A→Bf: A \to B is:

  • Everywhere defined: For every x∈Ax \in A, there exists a y∈By \in B such that (x,y)∈f(x, y) \in f.
  • Functional: For every x∈Ax \in A, there is at most one y∈By \in B such that (x,y)∈f(x, y) \in f.
  • Surjective: For every y∈By \in B, there exists an x∈Ax \in A such that (x,y)∈f(x, y) \in f.
  • Injective: For every y∈By \in B, there is at most one x∈Ax \in A such that (x,y)∈f(x, y) \in f.

1.4.5 Function composition

  • The composition of two functions f:A→Bf: A → B and g:B→Cg: B → C, denoted g ∘ f, is a function h:A→Ch: A → C defined by h(x) = g(f(x)).
  • Example: If f(x) = x^2 and g(x)=√xg(x) = √x:
    • (g∘f)(x)=g(f(x))=g(x2)=√(x2)=∣x∣(g ∘ f)(x) = g(f(x)) = g(x^2) = √(x^2) = |x|.
    • (f∘g)(x)=f(g(x))=f(√x)=(√x)2=x(f ∘ g)(x) = f(g(x)) = f(√x) = (√x)^2 = x (for x≥0x ≥ 0). 11 22.

(g∘f)(x)=g(f(x))(g \circ f)(x) = g(f(x))

1.5 Countable sets

  • A set is countable if its elements can be put into a one-to-one correspondence with the set of natural numbers N.
  • Finite sets and sets that can be put into one-to-one correspondence with N are countable.
  • The union of two countable sets is countable. 17.
  • Any subset of a countable set is countable.
  • Any infinite set contains a countable subset. 18 9.

A set is countable if it is finite or countably infinite.


🔑 Important: Understanding set operations and properties is fundamental for constructing more complex algebraic structures and reasoning about discrete mathematical objects.

2. Logic algebra: Boolean functions and circuits

Boolean algebra is a mathematical system used to analyze and design digital circuits. It deals with binary variables (0 or 1) and logical operations.

2.1 Boolean functions and their representation

A Boolean function defines a relationship between input variables and a single output variable, both taking binary values.

  • Truth table: Lists all possible input combinations and their corresponding output.
  • Algebraic expression: Uses logical operators (AND, OR, NOT) to represent the function.
  • Canonical forms: Standardized representations.
    • Disjunctive Normal Form (DNF): A disjunction (OR) of conjunctions (AND).
    • Conjunctive Normal Form (CNF): A conjunction (AND) of disjunctions (OR).
  • Sum of DNF (SDNF): A DNF where each term corresponds to a minterm (a conjunction where each variable appears exactly once, either complemented or not) that produces a '1' output.
  • Product of CNF (SCNF): A CNF where each term corresponds to a maxterm (a disjunction where each variable appears exactly once) that produces a '0' output.

For a function f(x1,x2,...,xn)f(x_1, x_2, ..., x_n):

  • SDNF: ∑(indices where f=1)\sum (\text{indices where } f=1)
  • SCNF: ∏(indices where f=0)\prod (\text{indices where } f=0)

2.2 Minimizing Boolean functions

Minimization aims to find an equivalent Boolean expression with the fewest literals and terms, leading to simpler and more efficient circuits.

2.2.1 Karnaugh maps (K-maps)

Karnaugh maps provide a visual method for simplifying Boolean functions.

  • Structure: A 2D table where cells represent minterms. Adjacent cells differ by only one variable, enabling simplification through grouping.
  • Adjacent cells: Cells sharing a side or wrapping around edges are considered adjacent.
  • Grouping: Group adjacent '1's for minimal DNF or adjacent '0's for minimal CNF. Groups must be powers of two (2k2^k) and as large as possible.
  • Rule: Each group corresponds to a product term in DNF or a sum term in CNF. Every '1' (for DNF) or '0' (for CNF) must be covered by at least one group.

K-maps simplify functions by grouping adjacent cells representing terms that differ by only one variable, effectively eliminating that variable.

2.2.2 Quine-McCluskey algorithm

This is a tabular method for function minimization, suitable for a larger number of variables than K-maps.

  • Process:
    1. List all minterms (or maxterms) as binary vectors.
    2. Group terms by the number of '1's.
    3. Combine adjacent terms that differ by one bit (apply the law xy+xyˉ=x(y+yˉ)=xxy + x\bar{y} = x(y + \bar{y}) = x). Mark combined terms.
    4. Repeat step 3 until no more combinations are possible. The resulting terms are prime implicants.
    5. Create a covering table. Rows represent prime implicants, columns represent minterms (or maxterms) from the original function. Place '1's where a prime implicant covers a minterm.
    6. Identify essential prime implicants (those that cover a minterm no other prime implicant covers).
    7. Select additional prime implicants to cover remaining minterms, aiming for the minimum number.
    8. The minimal DNF (or CNF) is the disjunction (or conjunction) of the selected essential and non-essential prime implicants.

The Quine-McCluskey algorithm systematically finds all prime implicants and then selects a minimal set to cover all required minterms (or maxterms).

Example: Minimizing f(x1,x2,x3,x4)=∑(0,1,2,3,4,7,8,11,12,13,15)f(x_1, x_2, x_3, x_4) = \sum(0, 1, 2, 3, 4, 7, 8, 11, 12, 13, 15) using Quine-McCluskey.

Prime ImplicantDecimal Equivalent of Minterms Covered
A0, 1, 2, 3, 12, 13
B8, 11, 12, 13
C3, 7, 11, 15
D0, 4, 8, 12
E4, 5, 12, 13
  • Essential Prime Implicants: B, D, E (based on coverage of unique minterms).
  • Minimal DNF: B+D+EB + D + E or B+C+D+EB + C + D + E, indicating multiple minimal forms.

2.3 Logic circuit synthesis

Logic circuit synthesis involves designing a circuit that implements a given Boolean function.

  • Standard forms: SDNF and SCNF are directly implementable as sum-of-products or product-of-sums circuits.
  • Logic gates: Basic building blocks like AND, OR, and NOT gates.
  • Universal gates: Gates from which any other logic gate can be constructed.
    • NAND (NOT-AND) gates: Can implement NOT, AND, and OR functions.
    • NOR (NOT-OR) gates: Can implement NOT, OR, and AND functions.

To synthesize a circuit using only NAND gates, first convert the function to DNF. Then, apply De Morgan's laws to transform the expression into a form realizable with NAND gates. For NOR gates, start with CNF and apply De Morgan's laws.

Circuit synthesis steps:

  1. Obtain the minimal DNF or CNF of the function.
  2. For NAND synthesis:
    • Double-complement the DNF: F=F‾‾F = \overline{\overline{F}}.
    • Apply De Morgan's law: A+B‾‾=A‾⋅B‾‾\overline{\overline{A+B}} = \overline{\overline{A}\cdot\overline{B}}.
    • This results in a NAND-only structure.
  3. For NOR synthesis:
    • Double-complement the CNF: F=F‾‾F = \overline{\overline{F}}.
    • Apply De Morgan's law: A⋅B‾‾=A‾+B‾‾\overline{\overline{A \cdot B}} = \overline{\overline{A} + \overline{B}}.
    • This results in a NOR-only structure.

Digital circuits are built using logic gates that perform Boolean operations. Minimizing the function often leads to fewer gates and simpler circuit designs.

Key takeaway: Boolean algebra provides the theoretical foundation for designing and simplifying digital logic circuits, with techniques like K-maps and Quine-McCluskey crucial for finding optimal implementations.

3. Graph theory: concepts and algorithms (part 1)

3.1 Graph basics and properties

  • Graph definition: A graph GG is defined by a set of vertices XX and a set of edges YY, denoted as G=(X,Y)G=(X, Y). The sets XX and YY are often represented as G=(X,U)G=(X,U) in the text.
  • Vertex degree: The degree of a vertex in an undirected graph is the number of edges connected to it.

    In any undirected graph with n≥2n \ge 2 vertices, at least two vertices share the same degree. This is because degrees can range from 0 to n−1n-1. If all degrees were distinct, you'd need nn distinct degrees, implying a vertex with degree 0 (isolated) and a vertex with degree n−1n-1 (connected to all others), which is a contradiction. [ ].

  • Complementary graphs: The complement of a graph G=(X,Y)G=(X, Y) is G′=(X,U)G'=(X, U), where two vertices are adjacent in G′G' if and only if they are not adjacent in GG.

    If graph GG is not connected, its complement G′G' is connected. If xx and yy are not adjacent in G′G', they are adjacent in GG. If GG is disconnected, there exists a connected component CC not containing xx or yy. If zz is in CC, then edges [x,z][x,z] and [y,z][y,z] exist in G′G', forming a path between xx and yy. [ ] 45.

  • Strongly connected graph: A directed graph is strongly connected if there is a path between every pair of vertices.
  • Tree: A tree is a connected graph without cycles.

    If HH is a tree and H1H_1, H2H_2 are its subtrees with intersection of vertex sets Y=X1∩X2Y = X_1 \cap X_2, then YY represents the vertices of one of HH's subtrees. This is because the subgraph formed by YY is acyclic (as HH is a tree). If x,yx, y are in YY, they have a path in H1H_1 and H2H_2. Since any two vertices in a tree are connected by a unique path, these paths must be the same and consist of vertices from YY. [ ] 46.

  • Simple path: A path is simple if all its vertices and edges are distinct.

    In a directed graph, if a path DD connects vertices xx and yy, a simple path also exists between xx and yy. This can be achieved by removing any cycles encountered in DD. If a vertex kk repeats in DD, the segment between its first and second occurrences can be removed to create a shorter path. Repeating this process yields a simple path. [ ].

  • Eulerian subgraph: A subgraph is Eulerian if it contains an Eulerian cycle. An Eulerian cycle visits every edge exactly once.

    If all vertex degrees in an undirected graph GG are even, GG contains a set of simple cycles such that each edge belongs to exactly one cycle. This implies each connected component is an Eulerian subgraph. Any non-simple cycle can be decomposed into simple cycles. Conversely, if each edge is in exactly one simple cycle, each vertex's degree must be even. [ ] 47.

3.2 Planar graphs and Euler's formula

  • Planar graph: A planar graph is one that can be drawn on a plane without any edges crossing except at their incident vertices.

    For a connected planar graph GG with nn vertices, mm edges, and ff faces (including the exterior face), Euler's formula states n−m+f=2n - m + f = 2. This can be proven by induction on the number of edges. The formula holds for m=0m=0. When adding an edge, either a new face is created, an existing face is split, or a vertex is added, all of which maintain the n−m+f=2n-m+f=2 relationship. [ ] 48.

3.3 Shortest and longest paths

  • Shortest path: The shortest path between two vertices in a weighted graph is the path with the minimum total weight.
  • Ford's algorithm (for shortest path): This algorithm finds the shortest paths from a single source vertex to all other vertices.
    • Initialize the source vertex's label (distance) to 0 and all others to infinity.
    • Iteratively update vertex labels. For an edge (u,v)(u, v) with weight LuvL_{uv}, if Hv−Hu>LuvH_v - H_u > L_{uv}, update HvH_v to Hu+LuvH_u + L_{uv}. This step continues until no more updates are possible.
    • The path is determined by backtracking from the destination vertex using the condition Hv−Hu=LuvH_v - H_u = L_{uv}. [ ] 53.
  • Ford-Fulkerson algorithm (for maximum flow): This algorithm finds the maximum flow in a transportation network.

    The maximum flow in a network equals the capacity of a minimum cut. The algorithm starts with zero flow and iteratively finds augmenting paths from source to sink to increase flow. This process continues until no more augmenting paths can be found. The "labeling method" is used to find these paths. [ ] 49.

  • Augmenting path: A path in a flow network from the source to the sink that has available capacity.
  • Capacity of a cut: The sum of capacities of edges that cross the cut from the source side to the sink side.
  • Bellman-Kalaba algorithm (for shortest path): This algorithm finds shortest paths from all vertices to a fixed destination vertex.
    • Construct a weighted adjacency matrix where entries are edge weights, infinity for non-existent edges, and 0 for self-loops.
    • Initialize a vector VV^{ } where Vi=LinV^{ }_i = L_{in} if an edge (xi,xn)(x_i, x_n) exists (where xnx_n is the destination) and −∞-\infty otherwise. Vn=0V^{ }_n=0.
    • Iteratively compute V(k)V^{(k)} using Vi(k)=min⁡j≠i(Vj(k−1)+Lji)V^{(k)}_i = \min_{j \ne i} (V^{(k-1)}_j + L_{ji}). The process stops when V(k)=V(k−1)V^{(k)} = V^{(k-1)}.
    • The path is found by backtracking. [ ] 58.
  • Longest path: The longest path between two vertices in a weighted graph is the path with the maximum total weight.
  • Bellman-Kalaba algorithm (for longest path): This algorithm finds longest paths from all vertices to a fixed destination vertex.
    • Construct a weighted adjacency matrix with −∞-\infty for non-existent edges.
    • Initialize Vi=LinV^{ }_i = L_{in} if an edge (xi,xn)(x_i, x_n) exists and −∞-\infty otherwise. Vn=0V^{ }_n=0 .
    • Iteratively compute V(k)V^{(k)} using Vi(k)=max⁡j≠i(Vj(k−1)+Lji)V^{(k)}_i = \max_{j \ne i} (V^{(k-1)}_j + L_{ji}). The process stops when V(k)=V(k−1)V^{(k)} = V^{(k-1)}.
    • The path is found by backtracking. [ ] 61.

3.4 Transportation networks and Hamiltonian paths

  • Transportation network: A directed graph where edges have capacities, representing the maximum flow that can pass through them.
  • Hamiltonian path: A simple path in a graph that visits every vertex exactly once.

    For a directed acyclic graph (DAG) of order nn, a Hamiltonian path exists if and only if the sum of the reachability degrees of its vertices equals n−1n-1. The reachability degree of a vertex is the number of vertices it can reach. [ ] 63.

4. Graph theory: concepts and algorithms (part 2)

4.1 Hamiltonian paths

  • A Hamiltonian path visits every vertex in a graph exactly once.
  • The text describes an algorithm to find Hamiltonian paths using adjacency and path matrices. This involves constructing an adjacency matrix, then a path matrix, and finally calculating reachability degrees.

Finding Hamiltonian paths

  • Path matrix construction: A path matrix DD indicates if a path exists between any two vertices xix_i and xjx_j.
    • If the ii-th row of the adjacency matrix AA has 1s at columns p,r,…,vp, r, \dots, v, logically add the corresponding rows from AA to the ii-th row of DD.
    • Repeat this process, logically adding elements from the new rows of DD to the ii-th row of DD.
    • This step is repeated for all rows to form the complete path matrix.
  • Reachability degree: The number of vertices reachable from a vertex xix_i.
    • This is calculated by summing the non-zero elements in the ii-th row of the path matrix.
  • Hamiltonian path condition: A graph has a Hamiltonian path if the sum of reachability degrees equals n(n−1)/2n(n-1)/2, where nn is the number of vertices.
  • The sequence of reachability degrees in descending order can represent the Hamiltonian path.

A directed acyclic graph cannot have more than one Hamiltonian path. This is because if another path existed, it would imply a cycle, which is impossible in an acyclic graph 65.

Kaufmann's algorithm for paths in directed graphs

This algorithm uses matrix multiplication to find simple paths of increasing length.

  • Step I: Latin Matrix (L)
    • Create a matrix LL where Lij=1L_{ij} = 1 if there is an edge from xix_i to xjx_j, and 00 otherwise.
  • Step II: Modified Latin Matrix (L*)
    • For each element LijL_{ij} that is 1, remove the ii-th element (the row index). This creates a modified matrix L∗L^*.
  • Step III: Latin Multiplication (L²) to find paths of length 2
    • Perform "Latin multiplication" of LL and L∗L^*.
    • Elements of L2L^2 are sequences of distinct digits formed by multiplying LL and L∗L^*.
    • If Lik=1L_{ik}=1 and Lkj∗L^*_{kj} is a sequence of distinct digits not including ii or kk, then Lij2L^2_{ij} contains the combined sequence i→k→ji \to k \to j (where jj is the sequence from Lkj∗L^*_{kj}).
  • Subsequent Steps (L³, L⁴, etc.)
    • Repeat the Latin multiplication process: L^k = L \cdot L^{k-1}^*, where L^{k-1}^* is the modified Lk−1L^{k-1} matrix.
    • The elements of LkL^k represent simple paths of length kk. 68.
  • Hamiltonian paths are found when the path length equals n−1n-1, where nn is the number of vertices.

📝 Example: Finding paths of length 2 using Kaufmann's algorithm involves multiplying the initial Latin Matrix (LL) by its modified version (L∗L^*). The resulting entries show all possible paths of exactly two edges 67.

4.2 Shortest path algorithms

Shortest path algorithms find the path with the minimum total weight between two vertices in a weighted graph.

Bellman-Ford algorithm

  • The Bellman-Ford algorithm finds the shortest paths from a single source vertex to all other vertices in a weighted graph.
  • It can handle graphs with negative edge weights, unlike Dijkstra's algorithm.
  • It works by repeatedly relaxing all edges. If after ∣V∣−1|V|-1 iterations, an edge can still be relaxed, it indicates a negative cycle.

🔑 Important: Bellman-Ford can detect negative cycles, which is crucial for some applications where negative edge weights might indicate an arbitrage opportunity.

Dijkstra's algorithm

  • Dijkstra's algorithm finds the shortest path from a single source vertex to all other vertices in a graph with non-negative edge weights.
  • It uses a greedy approach, always selecting the unvisited vertex with the smallest known distance from the source.

🔑 Important: Dijkstra's algorithm is more efficient than Bellman-Ford but only works on graphs with non-negative edge weights.

Ford's algorithm (often refers to Ford-Fulkerson for max flow)

The document mentions "алгоритм Форда" (Ford's algorithm) in the context of shortest paths. In many graph theory contexts, "Ford's algorithm" when discussing shortest paths can refer to variations or foundational ideas that paved the way for algorithms like Dijkstra's or could be a specific implementation.

However, the text also uses "алгоритм Форда" in the context of maximum flow problems, which is typically the Ford-Fulkerson algorithm. For shortest paths, it's likely referring to finding a minimum path, similar to Dijkstra or Bellman-Ford.

  • The document lists "алгоритм Форда" as a method to determine minimum paths. 78 79.

4.3 Maximum flow problems

Maximum flow algorithms determine the maximum rate at which "stuff" (e.g., data, goods, water) can be sent from a source to a sink in a network.

Ford-Fulkerson algorithm

  • The Ford-Fulkerson method is a general approach to solving maximum flow problems.
  • It works by repeatedly finding an "augmenting path" from the source to the sink in the residual graph.
  • An augmenting path is a path with available capacity. The flow is increased along this path until no more augmenting paths can be found.

🔑 Important: The Ford-Fulkerson algorithm guarantees finding the maximum flow if edge capacities are integers.

Applications of maximum flow

  • Transportation networks: Determining optimal routes for raw materials or goods. 77 80.
  • Resource allocation: Managing the flow of resources like water through a network of channels 83.
  • Shipment logistics: Calculating the maximum number of ships that can reach a destination through a network with capacity constraints 82.

4.4 Graph representations

The document briefly touches upon graph representations when discussing algorithms.

  • Adjacency matrix: A matrix where rows and columns represent vertices. The entry (i,j)(i, j) is 1 if there's an edge from vertex ii to vertex jj, and 0 otherwise. This is used for calculating paths and degrees.
  • Path matrix: Derived from the adjacency matrix, it indicates if a path exists between any two vertices.
  • Latin Matrix (L): Used in Kaufmann's algorithm, it is similar to an adjacency matrix but adapted for matrix multiplication to find paths 66.

📝 Example: An adjacency matrix is like a grid where each cell tells you if a direct connection exists between two points 64.

4.5 Properties of relations and their graphs

The text includes examples of defining relations, their properties, and then drawing their corresponding graphs.

  • Reflexive relation: A relation RR on a set MM is reflexive if for every element a∈Ma \in M, (a,a)∈R(a, a) \in R. The graph has a loop at every vertex. 69.
  • Antireflexive relation: A relation RR on a set MM is antireflexive if for every element a∈Ma \in M, (a,a)∉R(a, a) \notin R. The graph has no loops.
  • Symmetric relation: A relation RR is symmetric if for any a,b∈Ma, b \in M, if (a,b)∈R(a, b) \in R, then (b,a)∈R(b, a) \in R. In the graph, if there's an edge from aa to bb, there must also be an edge from bb to aa.
  • Transitive relation: A relation RR is transitive if for any a,b,c∈Ma, b, c \in M, if (a,b)∈R(a, b) \in R and (b,c)∈R(b, c) \in R, then (a,c)∈R(a, c) \in R. If there's a path a→b→ca \to b \to c, there must be a direct edge a→ca \to c. 72.
Type of RelationGraph Property
ReflexiveLoop at every vertex
AntireflexiveNo loops at any vertex
SymmetricEdges are bidirectional
TransitivePath a→b→ca \to b \to c implies edge a→ca \to c.
  • Multivalued mapping: A relation that assigns one or more outputs to each input 71.

🔑 Important: Understanding relation properties is key to interpreting their graphical representation and vice-versa 70.

5. Graph theory: concepts and algorithms (part 3)

5.1 Hamiltonian paths and cycles

Hamiltonian paths and cycles are fundamental concepts in graph theory, especially for problems involving order and traversal.

  • A Hamiltonian path visits every vertex in a graph exactly once.
  • A Hamiltonian cycle is a Hamiltonian path that returns to its starting vertex.

Graphs that contain Hamiltonian cycles are called Hamiltonian graphs. The existence of such paths or cycles often depends on specific graph properties.

The number of edges in a graph with nn vertices is related to the existence of Hamiltonian paths. For a graph to have a Hamiltonian path, the sum of vertices PiP_i must relate to nn.

If the sum of these values equals n(n−1)2\frac{n(n-1)}{2}, a Hamiltonian path may exist. If the sum of edges is less than n−1n-1, the graph cannot be acyclic.

For a graph with nn vertices, a Hamiltonian path exists if the sum of PiP_i is not equal to n(n−1)2\frac{n(n-1)}{2}. However, if the sum of edges is less than n−1n-1, the graph cannot be acyclic.

Several algorithms and methods can be used to find Hamiltonian paths and cycles:

  • Kaufman's Algorithm: Used to find Hamiltonian cycles in a given graph.
  • Latin Multiplication: Another method for identifying Hamiltonian paths 85.
  • Graph Construction: For specific vertex sets and edge relationships, a directed graph can be constructed to identify Hamiltonian paths 86.

5.1.1 Determining Hamiltonian paths and cycles

Determining if a graph is Hamiltonian or finding specific paths often involves checking vertex degrees and edge counts.

  • In graph problems involving prerequisites or ordering, constructing a directed graph can model these relationships. The vertices represent items, and directed edges represent the order they must be processed.
  • A graph is guaranteed to have a Hamiltonian path if it has nn vertices and its edge count is greater than or equal to n(n−1)2\frac{n(n-1)}{2}. If the edge count is less, a Hamiltonian path might not exist.
  • To create a Hamiltonian path, new edges may need to be added to the graph if one does not already exist. For instance, adding edges (6,4)(6,4) and (3,7)(3,7) can enable a Hamiltonian path in a specific graph.

Example: Given 5 products that need processing with specific precedence relations, a directed graph can be built. If the sum of PiP_i for these products equals 5(5−1)2=10\frac{5(5-1)}{2} = 10, a Hamiltonian path exists, defining the processing order 91.

  • A graph is not Hamiltonian if low-degree vertices are present, making it impossible to visit all vertices exactly once. For example, if vertices 1, 2, and 3 have degree 1, vertex 9 cannot be connected to all other vertices, contradicting its degree.

  • The adjacency matrix of a graph can also reveal properties related to Hamiltonian paths:

    • The sum of elements in row ii is the out-degree of vertex xix_i.
    • The sum of elements in column ii is the in-degree of vertex xix_i.
    • A vertex xix_i is isolated if all entries in its row and column are 0.
    • For any pair (i,j)(i, j) where i≠ji \ne j, at least one of aija_{ij} or ajia_{ji} must be 1 if there is an edge between them.

Key Relationship: Every edge (x,y)(x,y) (where yy is the end of the edge) contributes once to the out-degree of xx and once to the in-degree of yy 87.

  • Several Hamiltonian paths can exist in a single graph, offering choices for traversal or ordering. For example, multiple paths can be found in a graph with vertices 1 through 7 and 8, providing different sequences for visiting all nodes 92.

Important: The existence and number of Hamiltonian paths/cycles can be complex to determine, often requiring systematic search or algorithmic approaches rather than simple checks.

5.2 Shortest paths and transportation networks

Shortest path algorithms are crucial for finding optimal routes in networks, such as transportation or communication systems.

  • Finding the shortest path in a graph typically involves identifying a sequence of edges connecting two vertices with the minimum total weight. This is often applied to logistics and network design problems

  • Different paths can have the same minimum value, offering flexibility in route selection based on additional criteria. For instance, multiple paths might have the same minimal cost, allowing selection based on factors like the number of locations visited or industrial centers passed

  • Shortest path problems are common in real-world applications:

    • Information Transfer: Finding optimal time for data transmission.
    • Telephone Network Installation: Determining the minimum cost to connect network nodes.
    • Route Optimization: Finding the cheapest or fastest routes for transport.

Application: Defining the minimum cost for a telephone network setup is equivalent to finding the shortest path between two nodes in a graph representing costs 88.

  • When multiple shortest paths exist, the choice can be based on secondary factors. For example, selecting a path that passes through specific industrial centers or covers more locations is possible.

  • Some problems involve finding paths with maximum values, such as maximizing profit in a transportation network. This is equivalent to finding the longest path in a graph where edge weights represent profits

Example: To maximize profit in a transportation network, find the path between origin and destination nodes that yields the highest total profit. Several such paths might exist, allowing choice based on operational constraints 89.

  • In tournament graphs, maximizing the number of wins corresponds to finding a maximum path. The sequence of vertices in this path indicates the order of tournaments to participate in for the highest possible score.

Important: Shortest path algorithms are versatile and can be adapted to find maximum paths by simply inverting edge weights or by using algorithms designed for maximum path problems.

5.3 Network flow and cuts

Network flow problems deal with the maximum amount of "flow" that can pass through a network from a source to a sink.

  • The maximum flow in a network is the largest possible rate at which flow can be sent from a source to a sink node.
  • A cut is a partition of the vertices into two sets, one containing the source and the other the sink. The capacity of a cut is the sum of capacities of edges going from the source set to the sink set.
  • The max-flow min-cut theorem states that the maximum flow through a network is equal to the minimum capacity of a cut.

Example: In a transportation network, the maximum flow problem determines the maximum number of ships that can travel from a port of origin to a destination port. This is found using algorithms like Ford-Fulkerson.

  • Algorithms like the Ford-Fulkerson algorithm are used to find the maximum flow. This iterative process involves finding augmenting paths and increasing flow until no more paths can be found.

  • A cut divides the graph into two parts: one containing the source (AA) and the other containing the sink. The capacity of the cut (ω\omega) is the sum of capacities of edges from AA to the complement of AA (Aˉ\bar{A}).

Key Concept: The maximum flow value is equal to the minimum cut capacity. This is a cornerstone of network flow theory.

  • The capacity of a cut is calculated by summing the capacities of all edges that cross from the source side of the cut to the sink side. The minimum of these cut capacities gives the maximum flow.

Important: Understanding cuts helps in identifying bottlenecks in a network. The edges in a minimum cut represent the limiting factors for the total flow.

Example: For a network with a source and a sink, finding the minimum cut involves partitioning vertices into sets AA (containing the source) and Aˉ\bar{A} (containing the sink). The sum of capacities of edges from AA to Aˉ\bar{A} is calculated for various partitions, and the smallest sum is the maximum flow 90.

Summary: Network flow problems are essential for resource allocation and logistics, with the max-flow min-cut theorem providing a powerful tool for analysis.

🔑 Important: Understanding Hamiltonian paths and cycles is crucial for problems requiring traversal of all nodes exactly once, while shortest/longest path and network flow algorithms are vital for optimization in networks and resource management.

© 2026 Maeve. All rights reserved. This content is protected by copyright.

See also