Only write nonzero edges