title: How to search all paths between two nodes in linked list Graph
body: <p>I make a graph using a list of adjacency-based multivariable list. I have sold all certain functions that create a data structure, but I can not realize the search of all possible routes between two points ((. I thought a lot, but could not figure out how to get all the ways, not just one. I know i have to use BFS, but i cant come up nothing(</p>
  
  <pre><code>   #include &lt;iostream&gt;
      #include &lt;string&gt;
  
  
  using namespace::std;
  
  typedef string graphElement;
  
  typedef struct vertexTag {
      graphElement data;
      int visited;
  
      struct edgeTag* edges;
  
      struct vertexTag* next;
      struct vertexTag* prev;
  } vertexT;
  
  typedef struct edgeTag {
      struct vertexTag* connectsTo;
      struct edgeTag* next;
  } edgeT;
  
  class graph {
  private:
      vertexT* head;
      vertexT* tail;
      vertexT curr;
      int count_vertex;
      queue&lt;vertexT*&gt; queue;
  
      void BFS(graphElement destenetion, vertexT* startP);
      vertexT* FindVertex(graphElement data);
  
  public:
      graph();
      ~graph();
  
      vertexT* AddVertex(graphElement data);
      void DeleteVertex(graphElement data);
      edgeT* AddEdge(graphElement source, graphElement destination);
      void DeleteEdge(graphElement source, graphElement destination);
  
      void PrintGraph();
      void DiskIn();
      void DiskOut();
  
      void FindAllPaths(graphElement source, graphElement destenetion);
   };
  </code></pre>
  
  <p>it is BFS i tryed to make((. I know its not so good :(</p>
  
  <pre><code>void graph::FindAllPaths(graphElement source, graphElement destenetion) {
      vertexT *vertP;
      vertexT *startP = NULL;
  
      for (vertP = head; vertP != NULL; vertP = vertP-&gt;next) {
          vertP-&gt;visited = 0;
          if (vertP-&gt;data == source)
              startP = vertP;
      }
      if (startP == NULL)
      {
          cout &lt;&lt; "No such vertex";
          return;
      }
      else
      {
          BFS(destenetion, startP);
      }
  
  }
  
  void graph::BFS(graphElement destenetion, vertexT* startP) {
      vertexT* current;
      edgeT* edgeP;
      vector&lt;string&gt;path;
  
  
      queue.push(startP);
      //startP-&gt;visited = true;
  
      while (!queue.empty()) {
          current = queue.front();
          queue.pop();
          if (current-&gt;data == destenetion)
              copy(path.begin(), path.end(), ostream_iterator&lt;string&gt;(cout, " "));
          for (edgeP = startP-&gt;edges; edgeP != NULL; edgeP = edgeP-&gt;next) {
              //if (!edgeP-&gt;connectsTo-&gt;visited) {
                  queue.push(edgeP-&gt;connectsTo);
                  edgeP-&gt;connectsTo-&gt;visited = true;
                  path.push_back(edgeP-&gt;connectsTo-&gt;data);
          //  }
          }
      }
  }
  </code></pre>