Got rid of some boilerplate by pulling Brandes semiring deeper into the helper method