Does it work if you simplify `contains(names(attrs(g)), sparse_attr_matlab) ` to `exists(attrs(g), sparse_attr_matlab)`?