Graphically balanced equilibria and stationary measures of reaction networks