Suppose I have a dataset df like this, which contains adjacency information:
1 2 3 4 2 1 4 3 1 4 1 2 5 6 7 5 4 6 4 7 7 4 6
I want to convert this