Solved by albanD in post #2 
              
              
                Hi, 
You should be able to use triu_indices() here to get the indices and then just index adjacency with it using a single function call.