generic graph working