Graphs consist of points and lines. To create a graph, you have to define a set of points and any lines between them. The example code below contains a first simple graph consisting of four points and no lines.
An example code for a graph of type boost :: adjacency_list with four vertices
Output
Boost.Graph provides three containers to define graphs.
The most important container is boost::adjacency_list
which is used in nearly all of the examples in this chapter. To use this class, include the header file boost/graph/adjacency_list.hpp
. If you want to use another container, you must include another header file. There is no master header file to get access to all classes and functions from Boost.Graph.
boost::adjacency_list
is a template that is instantiated with default parameters in the above example code. This class is defined in boost
. All classes and functions from Boost.Graph are defined in this namespace.
The above example identifies points through positive integers. These numbers are indexes to a vector that is used internally in boost::adjacency_list
.
Comments