title: Smart pointers for graph representation (vertex neighbors) in C++11
body: <p>I was wondering how to use C++11 smart pointers correctly for graph representations.</p>
  
  <p>Suppose, you have a graph structure which contains a vector of all its vertices. Furthermore, you have a structure/class of vertex. This vertex contains a vector of all its neighbors (adjacency list).</p>
  
  <p>My question is: which types of pointers/smart pointers should I use, to represent this graph?</p>
  
  <p>For binary trees, I read, for parent nodes you should use raw pointers. Because a node doesn't own its parent. The childs of a binary tree could be represented by std::unique_ptr because the node have the ownership of the childs.</p>
  
  <p>But in a graph it is possible that multiple nodes have common neighbors. So, should I use a std::shared_ptr for this? Or should I use raw pointers, anyway?</p>