You can define an alias for the actual text first as A_F, define your relationship, and then use the alias operator for displaying, A_F: A F , so your code will be:
A_F
A_F: A F
graph TD; A_F-->B; A-->C; B-->D; C-->D; A_F: A F %% <--- this