Critcal structues GYM question

Правка en16, от L_lawliet27, 2020-12-20 13:21:27

Me and my teammate maverick16 were doing the Problem I.Critical Structures, in this Problem set and this is the CF Problem page.

In this problem, we are given a connected graph G and the following terminologies are defined:-

  1. Critical node: a node in G whose removal disconnects G.

  2. Critical link: an edge in G whose removal disconnects G.

  3. Critical component: a maximal set of edges in G such that any two edges in the set lie on a common cycle (A cycle is a set of nodes ⟨v0, v1, . . . , v k−1 ⟩, where k ≥ 4, such that any two consecutive vi−1 and vi for 1 ≤ i ≤ k − 1 have an edge, v0 = vk−1 and vi for 0 ≤ i ≤ k −2 are all distinct).

  4. Largest critical component: a critical component with the maximum number of edges.

We have to find number of critical nodes and critical links, p and q, where p/q is in irreducible form and are defined as follows :-

  1. p is the number of critical components

  2. q is the number of edges in the largest critical component.

Our approach to this problem is :

find all the bridges and cut vertices first, remove all the bridges. now apply dfs through individual component and count the edges in that component, we divided this into two cases from here:-

  1. there a single cut vertex in the component remove it and count both components (components separated by cut vertex) as different
  2. else take the complete component as a single critical component

p will be the number of components counted with this dfs + bridges and q will be max edges in a component.

But, this approach should fail, when the graph looks like this, however it passed all tests, can anyone help with this?

e3bdb2d21899c2412bed9758779159d6

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en19 Английский L_lawliet27 2020-12-20 14:45:19 1 (published)
en18 Английский L_lawliet27 2020-12-20 14:12:13 880 Tiny change: '6.png)\n\n' -> '6.png)\n\n<spoiler summary="try">\ngandu</spoiler>'
en17 Английский L_lawliet27 2020-12-20 13:22:02 6316 Reverted to en15
en16 Английский L_lawliet27 2020-12-20 13:21:27 6316 Tiny change: '6.png)\n\n' -> '6.png)\n\n<spoiler summary="Expected Output">\n...\n</spoiler>\n'
en15 Английский L_lawliet27 2020-12-20 13:07:24 871 Reverted to en12
en14 Английский L_lawliet27 2020-12-20 13:06:26 6
en13 Английский L_lawliet27 2020-12-20 13:05:30 865 (saved to drafts)
en12 Английский L_lawliet27 2020-12-20 10:19:07 0 (published)
en11 Английский L_lawliet27 2020-12-20 09:55:32 17 Tiny change: ' bridges\nq will b' -> ' bridges\n\nq will b'
en10 Английский L_lawliet27 2020-12-20 09:52:54 115
en9 Английский L_lawliet27 2020-12-20 09:30:09 121 Tiny change: 'this algo must fail according to us, when the' -> 'this algo should fail, when the'
en8 Английский L_lawliet27 2020-12-20 09:23:36 3765
en7 Английский L_lawliet27 2020-12-20 09:16:50 36
en6 Английский L_lawliet27 2020-12-20 09:16:11 3754 Tiny change: 'n">\n...\n</spoiler>\nsadfsdf\n' -> 'n">\n...\n...\n</spoiler>\n'
en5 Английский L_lawliet27 2020-12-19 21:35:16 22
en4 Английский L_lawliet27 2020-12-19 21:33:20 10 Tiny change: 'n">\n...\n\n~~~~~\n#' -> 'n">\n...\n~~~~~\n#'
en3 Английский L_lawliet27 2020-12-19 21:27:57 22
en2 Английский L_lawliet27 2020-12-19 21:05:13 12
en1 Английский L_lawliet27 2020-12-19 20:51:52 4835 Initial revision (saved to drafts)