I've a graph consisting of 22 nodes and 36 edges. It's an undirected graph. From each node, I've to find the number of ways that I can reach all other nodes. Any idea please?

# | User | Rating |
---|---|---|

1 | tourist | 3557 |

2 | Radewoosh | 3468 |

3 | Um_nik | 3429 |

4 | Petr | 3354 |

5 | Benq | 3286 |

6 | mnbvmar | 3280 |

7 | wxhtxdy | 3276 |

7 | LHiC | 3276 |

9 | ecnerwala | 3214 |

10 | yutaka1999 | 3190 |

# | User | Contrib. |
---|---|---|

1 | Errichto | 191 |

2 | Radewoosh | 180 |

3 | tourist | 173 |

4 | Vovuh | 165 |

4 | PikMike | 165 |

4 | antontrygubO_o | 165 |

7 | rng_58 | 160 |

8 | Um_nik | 156 |

8 | majk | 156 |

10 | 300iq | 155 |

I've a graph consisting of 22 nodes and 36 edges. It's an undirected graph. From each node, I've to find the number of ways that I can reach all other nodes. Any idea please?

↑

↓

Codeforces (c) Copyright 2010-2019 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Oct/19/2019 02:10:06 (h2).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|

What are the rules here? Can you use one edge or vertex multiple times?

Yes. But in a path I can't use a cycle. Cause it'll give me a infinite answer. Two paths will consider different, if at least 1 edge deffer.

Sorry I was sleeping when I replied to your comment. So, I messed Up. In a path I cant use a edge multiple times. It will create a cycle. For graph -

1 — 2

2 — 4

2 — 3

4 — 3

3 — 5

If we consider the source 1 and target 5 output will be 2 for that. Like that from every node to all other node I've to find the number of ways. I don't have any time limit. I can run the code for few hours. I just need the output. Thank You.

Since you only require the result and the graph is very small (and sparse), have you considered using brute force?

I was busy for few days, I ran brute force for this. Got my result.

Thank You.