title: Determine whether a network (graph) is connected based on its matrix
body: <p>How can I determine from a given m x n matrix desribing a two-mode network whether it is connected or not?</p>
  
  <p>Of course once can create a data structure for finding it out – but is there any mathematical solution?</p>
  
  <p>I found out for n x n matrices (one-mode network) it is easy: The solution would be: <code>M * M</code> and then looking at the diagonal in the resulting matrix. If there is any zero on the diagonal then it is not connected. Isn't that true?</p>
  
  <p>What would be your suggestion for both problems?</p>