title: Counting nodes in the largest cycle of an adjacency matrix
body: <p>I am currently writing a program using an undirected graph. Im representing this by creating an adjacency matrix of the connections.</p>
  
  <pre><code>if(adjacency_matrix[i][j] == 1){
      //i and j have and edge between them
  }
  else{
      //i and j are not connected
  }
  </code></pre>
  
  <p>What I am attempting to do is to find all the nodes that a given node is connected to (by any series of edges). I have tried to write a function that does this for a given node and returns a vector that contains either a 1 or 0 in each spot in the vector determined by whether the node is reachable by the given node by any path in the graph. I then want to take this vector and add up all the values in it, which will return the amount of nodes reachable by that node. I want to then take all these values for every node in the graph and put them in a vector, and then find the max value, which would represent the amount of nodes in the largest cycle.</p>
  
  <p>My issue is not that Im receiving errors with my function definition code (although I am), but rather that I realize I am writing this recursive function incorrectly, but am without a clue as to how to alter it to satisfy my need. I have included my code below, any guidance would be much appreciated.</p>
  
  <p>Function definition:</p>
  
  <pre><code>vector&lt;int&gt; get_conn_vect(int u, int conns, vector&lt;vector&lt;int&gt;&gt; vv, vector&lt;int&gt; seen)
  {
      seen.at(u) = 1;
      while(v &lt; conns)
      {
          if(seen.at(v) == 0 &amp;&amp; vv.at(u).at(v) == 1)
          {
              get_conn_vect(v, conns, vv, seen);
              v++;
          }
  
          else
          {
              v++;
          }
      }
      return seen;
  }
  </code></pre>
  
  <p>Call in main.cpp:</p>
  
  <pre><code>std::vector&lt;int&gt; conn_vect;
  int sum_of_elems = 0;
  for(int i = 0; i &lt; num_nodes; i++)
  {
      std::vector&lt;int&gt; seen_vect(matrix.size());
      sum_of_elems = 0;
      seen_vect = get_conn_vect(i, num_conn, matrix, seen_vect);
      conn_vect.push_back(sum_of_elems = std::accumulate(seen_vect.begin(), seen_vect.end(), 0));
  }
  </code></pre>