title: Is there a function making an adjacency matrix from index vector in matlab?
body: <p>I have a vector set as follows:</p>
  
  <pre><code>S = { [14, 2, 11, 10, 3, 8, 7, 1], [15, 4, 8, 7, 1], [16, 5, 4, 8, 7, 1] };
  </code></pre>
  
  <p>For example, S{1} means that there exists edges between (14,2), (2,11), (11,10), (10,3), (3,8), (8,7), (7,1).</p>
  
  <p>I want to make an adjacency matrix based on S. My code is as follows:</p>
  
  <pre><code>N = 20;
  A = zeros(N);
  for i=1:length(S)
      for j=1:length(S{i})-1
          from = S{i}(j);
          to = S{i}(j+1);
          A(from, to) = 1;
          A(to, from) = 1;
      end
  end
  </code></pre>
  
  <p>Is there a function working like my code?
  I think the existing code is much faster than my C-code-like code.</p>