The phylogenetic semigroup on a graph is a set of edge labelings of the graph by non-negative integers. It generalizes the Jukes–Cantor binary model on trees. Minimal generating sets of phylogenetic semigroups have been described for trivalent trees by Buczyńska and Wiśniewski, and for trivalent graphs with first Betti number 1 by Buczyńska. We characterize the degree two minimal generators of the phylogenetic semigroup on any trivalent graph. Moreover, for any graph with first Betti number 1 and for any trivalent graph with first Betti number 2 we describe the minimal generating set of its phylogenetic semigroup.