Factor graph reading IO functions, add Directedness ADT and function