Graph-based Learning Algorithm