Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(C++) Boost.Graph

 

Boost.Graph is a Boost library to work with graphs.

 

 

 

 

 

Boost.Graph example

 

#include <boost/graph/adjacency_list.hpp>

struct MyVertex
{
  MyVertex(const std::string& s) : m_s(s) {}
  const std::string m_s;
};

int main()
{
  typedef boost::vecS OutEdgeListS;
  typedef boost::vecS VertexListS;
  typedef boost::directedS DirectedS;
  typedef boost::no_property VertexProperty;
  typedef boost::no_property EdgeProperty;
  typedef boost::no_property GraphProperty;
  typedef boost::listS EdgeListS;
  typedef boost::adjacency_list
  <
    OutEdgeListS,
    VertexListS,
    DirectedS,
    VertexProperty,
    EdgeProperty,
    GraphProperty,
    EdgeListS
  > BasicGraphType;

  BasicGraphType g1;

  typedef boost::adjacency_list
  <
    OutEdgeListS,
    VertexListS,
    DirectedS,
    MyVertex,
    EdgeProperty,
    GraphProperty,
    EdgeListS
  > MyGraphType;

  MyGraphType g2;
}

 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict