Documentation

CslibFrontier.Computability.Complexity.Problems.FeedbackVertexSet

Feedback vertex sets #

FeedbackVertexSet is Karp's problem FEEDBACK NODE SET [Kar72], problem GT7 of Garey and Johnson for directed graphs: given a directed graph G and a number k, some set of at most k declared vertices meets every directed cycle; that is, removing it leaves an acyclic graph (Cslib.Complexity.mem_FeedbackVertexSet_iff_forall_isDirCycle). Graphs are read as directed graphs on their declared vertices (Cslib.Complexity.Graph.IsDirCycle), so a self-loop is a cycle of length one, and instances are encoded with the graph (encGraph) and k in binary (encNat) (Cslib.Complexity.FeedbackVertexSetInstance, encoded by Cslib.Complexity.encFeedbackVertexSet).

NP membership uses a list of numbers as the witness, read along the vertex list (Cslib.Complexity.colorOf): the vertices numbered 0 are removed, at most k of them, and every arc between remaining vertices must increase the number. Such a numbering exists exactly when removing the vertices numbered 0 leaves an acyclic graph, by topological numbering (Cslib.Complexity.Graph.isDirAcyclic_iff_exists_rank), and it can be taken at most the number of declared vertices.

Hardness is Karp's reduction from VertexCover (VertexCover.toFeedbackVertexSet): every edge between distinct vertices becomes two opposite arcs (VertexCover.bidirect), so the directed cycles of length two are the edges, every directed cycle contains an edge, and the feedback vertex sets are the vertex covers. Since VertexCover rejects targets above the number of distinct declared vertices, such targets are mapped to a fixed graph without feedback vertex set of size 0.

Main definitions #

Main results #

References #

An instance (graph, bound) of Feedback Vertex Set.

  • graph : Graph

    The directed graph whose directed cycles must be hit.

  • bound : ℕ

    The maximum number of vertices to remove.

Instances For
    @[reducible, inline]

    The tuple of the fields of encFeedbackVertexSet.

    Instances For
      theorem Cslib.Complexity.encFeedbackVertexSet_mk_inO {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → Graph} {T0 S0 x1 T1 S1 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO x0 encIn encGraph T0 S0) (h1 : Turing.MultiTapeTM.ComputableInO x1 encIn Turing.MultiTapeTM.encNat T1 S1) :
      Turing.MultiTapeTM.ComputableInO (fun (x : γ) => { graph := x0 x, bound := x1 x }) encIn encFeedbackVertexSet (fun (x : γ) => T0 x + T1 x) fun (x : γ) => S0 x + S1 x
      theorem Cslib.Complexity.encFeedbackVertexSet_mk_budget {γ : Type} {encIn : γ ↪ List Bool} {budget : γ → ℕ} {x0 : γ → Graph} {x1 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInSpace x0 encIn encGraph budget) (h1 : Turing.MultiTapeTM.ComputableInSpace x1 encIn Turing.MultiTapeTM.encNat budget) :
      Turing.MultiTapeTM.ComputableInSpace (fun (x : γ) => { graph := x0 x, bound := x1 x }) encIn encFeedbackVertexSet budget
      theorem Cslib.Complexity.encFeedbackVertexSet_bound_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → FeedbackVertexSetInstance} :
      theorem Cslib.Complexity.encFeedbackVertexSet_graph_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → FeedbackVertexSetInstance} :
      Turing.MultiTapeTM.ComputableInSpace g✝ encIn✝ encFeedbackVertexSet S✝ → Turing.MultiTapeTM.ComputableInSpace (fun (a : γ✝) => (g✝ a).graph) encIn✝ encGraph S✝

      Feedback vertex set [Kar72] Garey and Johnson, Problem GT7: the directed graphs with a number k such that removing some set of at most k declared vertices leaves no directed cycle.

      Instances For
        theorem Cslib.Complexity.mem_FeedbackVertexSet_iff {G : Graph} {k : ℕ} :
        { graph := G, bound := k } ∈ FeedbackVertexSet ↔ ∃ (R : Finset ℕ), (∀ v ∈ R, v ∈ G.vertices) ∧ R.card ≤ k ∧ (G.deleteVerts R).IsDirAcyclic
        theorem Cslib.Complexity.mem_FeedbackVertexSet_iff_forall_isDirCycle {G : Graph} {k : ℕ} :
        { graph := G, bound := k } ∈ FeedbackVertexSet ↔ ∃ (R : Finset ℕ), (∀ v ∈ R, v ∈ G.vertices) ∧ R.card ≤ k ∧ ∀ (c : List ℕ), G.IsDirCycle c → ∃ v ∈ c, v ∈ R

        Membership in FeedbackVertexSet through cycles: at most k declared vertices meet every directed cycle.

        Membership in NP #

        Reduction from vertex covers #

        Both arcs of every edge between distinct vertices: the directed graph whose cycles of length two are the edges.

        Instances For

          The arcs of bidirect G join the adjacent declared vertices of G.

          Karp's reduction from VertexCover: keep the target and make every edge two opposite arcs, or produce a self-loop with target 0 when the target exceeds the number of distinct declared vertices.

          Instances For

            Karp's reduction is polynomial-time: the number of distinct declared vertices is computed in unary and compared with the binary target.

            Feedback vertex set is NP-complete, for directed graphs with the target in binary [Kar72].