How does construction of dams across the river get linked with the production of greenhouse gases?

The vegetation which is submerged, rots in anaerobic condition and gives out large amount of methane ($CH_{4}$) in nature which is a greenhouse gas.