![]() |
||||||||||
|
||||||||||
Number of Connected SubgraphTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 196 Accepted Submission(s): 5 Problem Description A cactus is a connected undirected graph in which every edge belongs to at most one simple cycle. Intuitively, cactus is a generalization of a tree where some cycles are allowed. Given an undirected graph $G(V,E)$, where $ V $ is the set of vertices and $ E $ of edges, where an edge is a set of two distinct vertices $ \{v_1,v_2\}\subseteq V $. An $induced\ subgraph$ of a graph is another graph, formed from a subset of the vertices of the graph and $all$ of the edges connecting pairs of vertices in that subset. Now, here comes the problem: How many induced subgraphs of a cactus are still cactuses? Input There are several cases, process till end of input. For each case, the first line contains an integer $ N $, the second line an integer $ M $, denoting respectively the number of vertices and edges of the given directed graph. Each of the following $ M $ lines contains two integers $ u$ and $v$, meaning there is one edge between $ u $ and $ v $. You can assume that $\cdot$ the given graph is always a cactus $\cdot$ $ N,M\le 100000 $ Output For each case output your answer mod 1000000007 on a single line. Sample Input
Sample Output
Source | ||||||||||
|