Minimum path width in directional acyclic graph

The question I ask here is already asked before the stack overflows. But I can not correctly understand the solutions sent by Skiminok .

Here's the link .

I tried the solution posted at the above link, with two examples of test cases, but I can not get the correct answer.

For test case 1 ::

N = 3 and K = 2

5 4 7

DAG will be ::

The directed acyclic graph for sample test case 1

Note. I built the above DAG group considering:

Let pi and pj be two different tasks. Then we draw a directed edge from pi to pj if and only if pj can be solved immediately after pi on the same day, sequentially. Namely, the following conditions must be met:

i <j, because you have to solve the less complicated problem before.

| vi - vj | > = K (assessment requirement).

, ::

(u, v) DAG (au, bv) , {ai} {bi} - n.

enter image description here

= .

= 1 ( egde)

2.

2:

5 1

5 3 4 5 6

enter image description here

enter image description here

MAx , 1.

, , , , . - .

!

+5
1

, .

.

. / - SET B, .

1::

M = {(1A, 3B)}.

( 1 2). = 2

2::

M = {(1A, 2B), (2A, 3B), (3A, 4B), (4A, 5B)}.

( 1). 1

0

All Articles