title: Creating Adjacency Matrix from non square MATRIX
body: <p>I want to create an Adjancey Matrix from a non-square matrix. The rows and columns both define different variables. In the example row represents unique funds where column represents unique firms. </p>
  
  <p>This code creates 10x10 matrix with repeated values where as I want to create 6x6 matrix as shown below</p>
  
  <pre><code>    expand.matrix &lt;- function(A){
        m &lt;- nrow(A)
        n &lt;- ncol(A)
        B &lt;- matrix(0,nrow = m, ncol = m)
        C &lt;- matrix(0,nrow = n, ncol = n)
        cbind(rbind(B,t(A)),rbind(A,C))
      }
  
  df &lt;- expand.matrix(dat)
  </code></pre>
  
  <p><a href="https://stackoverflow.com/questions/46056149/converting-not-a-square-weighted-adjacency-matrix-to-igraph-object-in-r">Converting not a Square weighted adjacency matrix to igraph object in R</a></p>
  
  <p>My matrix is</p>
  
  <pre><code>dat &lt;- structure(c(0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 
  1), .Dim = c(3L, 6L), .Dimnames = structure(list(c("Fund 1", 
  "Fund2", "Fund3"), c("Firm A", "Firm B", "Firm C", "Firm D", 
  "Firm E", "Firm F")), .Names = c("", "")), class = "table")
  </code></pre>
  
  <p>Expected results</p>
  
  <p><a href="https://i.stack.imgur.com/qAbo0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qAbo0.png" alt="enter image description here"></a></p>