Is there a suitable algorithm to solve the problem of edge removal?

There is a directed graph (not necessarily connected) from which one or more nodes differ as sources. Any node accessible from any of the sources is considered "lit." Now suppose that one of the edges is deleted. The problem is to identify the nodes that were previously lit and no longer burned.

It can be assumed that an analogy, for example, a city electric system, can be considered.

+5
source share
5 answers

This is a "dynamic gradation of reachability" problem. The following article should be helpful:

. Liam Roditty, Uri Zwick. , 2002.

O (m * sqrt (n)) - () O (sqrt (n)) - - ( m - n ). , O (m) -time () O (n/log n) -time-.

, , , .

+7

"" " " , node, node "" node "", node node.

EDIT: : node , node, " " (, , ..)

EDIT2 ( tafa): -: , , node , , , .

, node , , , / . , A, B, C, D, : ( ascii)

A -> B >- D
 \-> C >-/

node A , (, , ), B C , A, D , A, C.

, B D: D B lit-source-list, , A. , A C : A C, , , C . , C, C D, . , , D.

- , , ( , node), .

+1

?

- DFS (http://en.wikipedia.org/wiki/Depth-first_search) BFS (http://en.wikipedia.org/wiki/Breadth-first_search) , . .

. DFS. , .

, , .

, DFS ( BFS), O (n + m) ( n = , m = ), . o (n + m) , .

, , . . , ?

EDIT: :

  • ,
  • DFS BFS ( BFS). /.

BFS, , :

Queue q = [all starting nodes]
while (q not empty)
{
   x = q.pop()
   forall (y neighbour of x) {
      if (y was not visited) {
         visited[y] = true
         q.push(y)
      }
   }
}

, DFS.

+1

? , node .

EDIT:

DFS node. , node ( , , , , ). node node.

. , node. node , , .

0

(, S1 S2, S1 S2). . , node , node. , DFS BFS. ( ). - , (lit- > notit nodes). , , , , .

0

All Articles