#P5871. Number of Connected Subgraph
Number of Connected Subgraph
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.
4
4
1 2
2 3
3 4
4 1
5
6
1 2
2 3
3 1
2 4
4 5
5 2
13
22