// Instead of saving successors or predecessors to allow recovering // a connecting path, this version saves the (column) vertex providing // the transitivity. Recovering the path is done recursively. #include #define NOTCONNECTED (-1) #define DIRECT (-2) void printIntermediate(int col[10][10],int i,int j) // "Inorder" traversal of tree that gives a path. { if (col[i][j]==DIRECT) return; printIntermediate(col,i,col[i][j]); printf("%d ",col[i][j]); printIntermediate(col,col[i][j],j); } main() { int col[10][10],n,i,j,k; scanf("%d",&n); for (i=0;i