Single-stranded RNAs of simple viruses seem to be topologically more compact than other types of single-stranded RNA. It has been suggested that this has an evolutionary purpose: more compact structures are more easily encapsulated in the limited space that the cavity of the virus capsid offers. We employ a simple Flory theory to calculate the optimal amount of polymers confined in a viral shell. We find that the free energy gain or more specifically the efficiency of RNA encapsidation increases substantially with topological compactness. We also find that the optimal length of RNA encapsidated in a capsid increases with the degree of branching of the genome even though this effect is very weak. Further, we show that if the structure of the...