Versatile and Risk-Sensitive Cardiac Diagnosis via Graph-Based ECG Signal Representation