part 2 fucntion digramFreqMatrix and headfile