A mixed structural/functional graph based model for fault diagnosis and systemic risk analysis