Skip to main content
added 212 characters in body
Source Link
PK96
  • 71
  • 8

Given an undirected and unweighted graph $G = (V, E)$ and two of its vertices $s$ and $t$. My task is to find an algorithm that checks if there exists an edge belonging to $E$ such that its removal will result in the shortest path from $s$ to $t$ being extended (and if so returns this edge). We may remove only one edge.

In practice, a graph is given as a list of lists. The $i$-th list contains the numbers of vertices adjacent to the $i$-th vertex (numbered from 0).

Example:
$G = [ [1,2], [0,2], [0,1] ]$
$s = 0$
$t = 2$

The answer is an edge terminated by vertices 0 and 2 - the shortest path has been extended from 1 to 2.

How can this problem be solved in optimal time?

All I know is that the best way to find the shortest path in a basic graph like this is to just use BFS, and I guess I have to use it somehow here as well, but otherwise I have no idea how to approach this...

Given an undirected and unweighted graph $G = (V, E)$ and two of its vertices $s$ and $t$. My task is to find an algorithm that checks if there exists an edge belonging to $E$ such that its removal will result in the shortest path from $s$ to $t$ being extended (and if so returns this edge). We may remove only one edge.

In practice, a graph is given as a list of lists. The $i$-th list contains the numbers of vertices adjacent to the $i$-th vertex (numbered from 0).

Example:
$G = [ [1,2], [0,2], [0,1] ]$
$s = 0$
$t = 2$

The answer is an edge terminated by vertices 0 and 2 - the shortest path has been extended from 1 to 2.

How can this problem be solved in optimal time?

Given an undirected and unweighted graph $G = (V, E)$ and two of its vertices $s$ and $t$. My task is to find an algorithm that checks if there exists an edge belonging to $E$ such that its removal will result in the shortest path from $s$ to $t$ being extended (and if so returns this edge). We may remove only one edge.

In practice, a graph is given as a list of lists. The $i$-th list contains the numbers of vertices adjacent to the $i$-th vertex (numbered from 0).

Example:
$G = [ [1,2], [0,2], [0,1] ]$
$s = 0$
$t = 2$

The answer is an edge terminated by vertices 0 and 2 - the shortest path has been extended from 1 to 2.

How can this problem be solved in optimal time?

All I know is that the best way to find the shortest path in a basic graph like this is to just use BFS, and I guess I have to use it somehow here as well, but otherwise I have no idea how to approach this...

Source Link
PK96
  • 71
  • 8

Is there an edge whose removal will extend the shortest path? - graph problem

Given an undirected and unweighted graph $G = (V, E)$ and two of its vertices $s$ and $t$. My task is to find an algorithm that checks if there exists an edge belonging to $E$ such that its removal will result in the shortest path from $s$ to $t$ being extended (and if so returns this edge). We may remove only one edge.

In practice, a graph is given as a list of lists. The $i$-th list contains the numbers of vertices adjacent to the $i$-th vertex (numbered from 0).

Example:
$G = [ [1,2], [0,2], [0,1] ]$
$s = 0$
$t = 2$

The answer is an edge terminated by vertices 0 and 2 - the shortest path has been extended from 1 to 2.

How can this problem be solved in optimal time?