Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8025399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T23:09:11+00:00 2026-06-04T23:09:11+00:00

Enumerating all simple paths between two vertices in an arbitrary graph takes exponential time

  • 0

Enumerating all simple paths between two vertices in an arbitrary graph takes exponential time in general, because there may be an exponential number of simple paths between the vertices. But what about if we’re only interested in the vertices that are on at least one simple path between the two end vertices?

That is: Given an undirected graph and two distinct vertices, is there a polynomial-time algorithm which finds every vertex which is on at least one simple path between the two vertices? This is not the same as connectivity; dead-ends and cul-de-sacs are excluded. Branching and joining paths, however, are permissible.

I’ve found that it’s very easy to write an algorithm which looks like it solves this problem, but either fails in some case, or takes exponential running time in pathological cases.

More generally: Given two disjoint sets of vertices in a graph, is there a polynomial-time algorithm which finds all vertices which lie on a simple path from a vertex in one set to a vertex in the other set?

(Forgive me if there’s a really obvious solution to this. It certainly feels like there should be.)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T23:09:12+00:00Added an answer on June 4, 2026 at 11:09 pm

    Here is a linear-time deterministic solution. Inserting an edge between your two end vertices (let’s call them a and b), if such an edge doesn’t already exist, turns your problem into the problem of finding a maximum set of vertices v that lie on any simple cycle through a and b. You can convince yourself that such a set corresponds to the maximal subgraph containing a and b that cannot be disconnected by removal of any of its nodes (also called biconnected component). This page describes the concept and the classic linear-time (DFS-based) algorithm of Hopcroft and Tarjan to identify all biconnected components (you only need the one containing a and b).

    Your second question about simple paths between two sets (let’s call them A and B) can reduced to the first question by creating a new vertex a with edges to all vertices in A, and a vertex b with edges to all vertices in B, and then solving your first question for a and b.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm enumerating all databases of an SQL Server 2005 instance using SMO like as
You'd think that it would be simple, isn't there something simple to do this?
I have a problem that is seemingly solvable by enumerating all possible solutions and
I am developing a simple process statistics collection library for Windows. I'm enumerating the
Is there any way to catch all syscalls on Linux? The only solution I
Possible Duplicate: Modifying .NET Dictionary while Enumerating through it I have a dictionary object
In a Visual Studio Add-In, I'm enumerating over the members of a class in
I've got an enumeration in my game. A simple string message with an appended
I have a simple class that holds skeleton for a much larger, bulkier class.
I've got a simple list page with a couple of search filters status which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.