  Closed graphs have been characterized by Herzog et al. as the graphs whose
binomial edge ideals have a quadratic Gr\"obner basis with respect to a
diagonal term order. In this paper, we focus on a generalization of closed
graphs, namely weakly-closed graphs (or co-comparability graphs). Build on some
results about Knutson ideals of generic matrices, we characterize weakly closed
graphs as the only graphs whose binomial edge ideals are Knutson ideals for a
certain polynomial $f$. In doing so, we re-prove Matsuda's theorem about the
F-purity of binomial edge ideals of weakly closed graphs in positive
characteristic and we extend it to generalized binomial edge ideals.
Furthermore, we give a characterization of weakly closed graphs in terms of the
minimal primes of their binomial edge ideals and we characterize all minimal
primes of Knutson ideals for this choice of $f$.
