Graph-based classification for stationary and non-stationary data