example from scientific computing: matrix product versus BFS on graph