Use the Matrix object in graph