Summing Weighted Unicyclic Subgraphs via Bitmask DP and Inclusion-Exclusion
Given an undirected graph (G=(V,E)) with (|V|=n \leq 16) and (|E| \leq \binom{n}{2}), compute the sum of weights of all unicyclic subgraphs. The weight of a unicyclic subgraph is defined as (2^w), where (w) is the number of non-leaf nodes in the subgraph. We first calculate cycle_count[S], the numbe...