edge matrices
mathematica nb for gradient