F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Number of Connected Subgraph

Time 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
4 4 1 2 2 3 3 4 4 1 5 6 1 2 2 3 3 1 2 4 4 5 5 2
 

Sample Output
13 22
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-04-26 04:54:27, Gzip enabled