diff --git a/BGL/doc/BGL/BGL.txt b/BGL/doc/BGL/BGL.txt
index 6a319650062..23c63b9f37d 100644
--- a/BGL/doc/BGL/BGL.txt
+++ b/BGL/doc/BGL/BGL.txt
@@ -254,15 +254,9 @@ The main function illustrates the access to the `id()` field.
\section BGLTriangulations Triangulations as Models of the Boost Graph Concept
Triangulations have vertices and faces, allowing for a direct translation
-as a graph. An edge is defined as a pair of a face handle and the
-index of the edge.
-Particular care has to be taken with the infinite vertex and its incident
-edges. One can either use a
-boost::filtered_graph
-in order to make the infinite edges
-invisible, or one can have a property map that returns an infinite length
-for these edges.
-A complete list can be found in the documentation of \link BGLT2GT boost::graph_traits \endlink.
+as a graph. A halfedge is defined as a pair of a face handle and the
+index of the edge. A complete list can be found in the documentation
+of \link BGLT2GT boost::graph_traits \endlink.
A classical example for an algorithm that is a combination of
computational geometry and graph theory is the Euclidean Minimum
@@ -291,7 +285,7 @@ use the property map returned by the call `get(boost::vertex_index,ft)`.
This property map assumes that the vertex has a
member function `id()` that returns a reference to an int.
Therefore \cgal offers a class `Triangulation_vertex_base_with_id_2`.
-It is in the users responsibility to set the indices properly.
+It is in the user's responsibility to set the indices properly.
The example further illustrates that the graph traits also works
for the Delaunay triangulation.
diff --git a/BGL/doc/BGL/CGAL/Triangulation_face_base_with_id_2.h b/BGL/doc/BGL/CGAL/Triangulation_face_base_with_id_2.h
new file mode 100644
index 00000000000..83e14e58af7
--- /dev/null
+++ b/BGL/doc/BGL/CGAL/Triangulation_face_base_with_id_2.h
@@ -0,0 +1,45 @@
+namespace CGAL {
+
+/*!
+\ingroup PkgBGLHelper
+
+The class `Triangulation_face_base_with_id_2` is a model of the
+concept `TriangulationFaceBase_2`, the base face of a
+2D-triangulation. It provides an integer field that can be used to
+index faces for \sc{Bgl} algorithms.
+
+Note that the user is in charge of setting indices correctly before
+running a graph algorithm.
+
+\tparam TriangulationTraits_2 is the geometric traits class
+and must be a model of `TriangulationTraits_2`.
+
+\tparam TriangulationFaceBase_2 must be a face base class from which
+`Triangulation_face_base_with_id_2` derives. It has the default
+value `Triangulation_face_base_2`.
+
+\cgalModels `TriangulationFaceBase_2`
+
+\sa `CGAL::Triangulation_face_base_2`
+*/
+template< typename TriangulationTraits_2, typename TriangulationFaceBase_2 >
+class Triangulation_face_base_with_id_2 : public TriangulationFaceBase_2 {
+public:
+
+/// \name Access Functions
+/// @{
+
+/*!
+Returns the index.
+*/
+int id() const;
+
+/*!
+Returns a reference to the index stored in the face.
+*/
+int& id();
+
+/// @}
+
+}; /* end Triangulation_face_base_with_id_2 */
+} /* end namespace CGAL */
diff --git a/BGL/doc/BGL/Doxyfile.in b/BGL/doc/BGL/Doxyfile.in
index 9681886835a..c676a95fc13 100644
--- a/BGL/doc/BGL/Doxyfile.in
+++ b/BGL/doc/BGL/Doxyfile.in
@@ -4,6 +4,7 @@ PROJECT_NAME = "CGAL ${CGAL_DOC_VERSION} - CGAL and the Boost Graph Library"
INPUT += ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/boost/graph/Euler_operations.h \
${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/boost/graph/iterator.h \
${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/boost/graph/helpers.h \
+ ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/boost/graph/generators.h \
${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/boost/graph/selection.h \
${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/boost/graph/split_graph_into_polylines.h \
${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/boost/graph/copy_face_graph.h \
diff --git a/BGL/doc/BGL/PackageDescription.txt b/BGL/doc/BGL/PackageDescription.txt
index ae7ea66baa1..287b2662399 100644
--- a/BGL/doc/BGL/PackageDescription.txt
+++ b/BGL/doc/BGL/PackageDescription.txt
@@ -546,7 +546,12 @@ Methods to read and write graphs.
\cgalPkgPicture{emst-detail.png}
\cgalPkgSummaryBegin
\cgalPkgAuthors{Andreas Fabri, Fernando Cacciola, Philipp Moeller, and Ron Wein}
-\cgalPkgDesc{This package provides a framework for interfacing \cgal data structures with the algorithms of the Boost Graph Library, or \sc{BGL} for short. It allows to run graph algorithms directly on \cgal data structures which are model of the \sc{BGL} graph concepts, for example the shortest path algorithm on a Delaunay triangulation in order to compute the Euclidean minimum spanning tree. Furthermore, it introduces several new graph concepts describing halfedge data structures.}
+\cgalPkgDesc{This package provides a framework for interfacing \cgal data structures
+ with the algorithms of the Boost Graph Library, or \sc{BGL} for short.
+ It allows to run graph algorithms directly on \cgal data structures which are model
+ of the \sc{BGL} graph concepts, for example the shortest path algorithm
+ on a Delaunay triangulation in order to compute the Euclidean minimum spanning tree.
+ Furthermore, it introduces several new graph concepts describing halfedge data structures.}
\cgalPkgManuals{Chapter_CGAL_and_the_Boost_Graph_Library,PkgBGLRef}
\cgalPkgSummaryEnd
\cgalPkgShortInfoBegin
@@ -593,6 +598,7 @@ user might encounter.
\cgalCRPSection{Helper Classes}
- `CGAL::Triangulation_vertex_base_with_id_2`
+- `CGAL::Triangulation_face_base_with_id_2`
- `CGAL::Arr_vertex_index_map`
- `CGAL::Arr_face_index_map`
- `CGAL::HalfedgeDS_vertex_max_base_with_id`
diff --git a/BGL/doc/BGL/graph_traits.txt b/BGL/doc/BGL/graph_traits.txt
index 1413197ecc6..4ea10583ee7 100644
--- a/BGL/doc/BGL/graph_traits.txt
+++ b/BGL/doc/BGL/graph_traits.txt
@@ -150,30 +150,29 @@ and `CGAL::Triangulation_hierarchy_2`
so that they are model of the graph concepts
`BidirectionalGraph`, `VertexAndEdgeListGraph`, and `FaceListGraph`.
-The mapping between vertices and edges of the triangulation and the
+Only finite simplices exist when viewed through the scope of these graph traits classes.
+The infinite vertex, halfedges, edges, and faces will thus not appear when looping around a border
+vertex, or walking through the faces container.
+
+The mapping between vertices, edges, and faces of the triangulation and the
graph is rather straightforward, but there are some subtleties. The
value type of the \sc{Bgl} iterators is the vertex or edge descriptor,
whereas in \cgal all iterators and circulators are also handles and
hence have as value type Vertex or Edge.
-The graph traits class for triangulations does not distinguish between
-finite and infinite vertices and edges. As the edge weight computed
-with the default property map of \sc{Bgl} algorithms (obtained with
-`get(t, boost::edge_weight)`) is the length of the edge,
-the edge weight is not well defined for infinite edges. For algorithms
-that make use of the edge weight, the user must therefore
-define a `boost::filtered_graph` or pass a property map to the
-algorithm that returns "infinity" for infinite edges.
-
| Member | Value | Description |
| :----------------------- | :----: | :---------- |
-| `vertex_descriptor` | `Triangulation::Vertex_handle` | Identify vertices in the graph. |
-| `edge_descriptor` | `unspecified_type` | Identify edges in the graph. It is constructible from and convertible to `Triangulation::Edge`. It is not a simple typedef, but a proper class, because in an undirected graph the edges `(u,v)` and `(v,u)` must be equal. This is not the case for the Edge type of the triangulation. |
+| `vertex_descriptor` | `unspecified_type` | Identify vertices in the graph. |
+| `halfedge_descriptor` | `unspecified_type` | Identify halfedges in the graph. It is constructible from and convertible to `Triangulation::Edge`. It is not a simple typedef, but a proper class, because there is no representation for halfedges in the 2D triangulation data structure. |
+| `edge_descriptor` | `unspecified_type` | Identify edges in the graph. It is constructible from and convertible to `Triangulation::Edge`. It is not a simple typedef, but a proper class, because in an undirected graph the edges `(u,v)` and `(v,u)` must be equal. This is not the case for the Edge type of the triangulation. |
+| `face_descriptor` | `unspecified_type` | Identify faces in the graph. |
| `adjacency_iterator` | `unspecified_type` | An iterator to traverse through the vertices adjacent to a vertex. Its value type is `vertex_descriptor`. |
| `out_edge_iterator` | `unspecified_type` | An iterator to traverse through the outgoing edges incident to a vertex. Its value type is `edge_descriptor`. |
| `in_edge_iterator` | `unspecified_type` | An iterator to traverse through the incoming edges incident to a vertex. Its value type is `edge_descriptor`. |
-| `vertex_iterator` | `unspecified_type` | An iterator to traverse through the vertices of the graph. Its value type is `vertex_descriptor`. |
-| `edge_iterator` | `unspecified_type` | An iterator to traverse through the edges of the graph. Its value type is `edge_descriptor`. |
+| `vertex_iterator` | `unspecified_type` | An iterator to traverse through the vertices of the graph. Its value type is `vertex_descriptor`. |
+| `halfedge_iterator` | `unspecified_type` | An iterator to traverse through the halfedges of the graph. Its value type is `halfedge_descriptor`. |
+| `edge_iterator` | `unspecified_type` | An iterator to traverse through the edges of the graph. Its value type is `edge_descriptor`. |
+| `face_iterator` | `unspecified_type` | An iterator to traverse through the faces of the graph. Its value type is `face_descriptor`. |
| `directed_category` | `boost::undirected_tag` | This graph is not directed. |
| `edge_parallel_category` | `boost::disallow_parallel_edge_tag` | This graph does not support multiedges. |
| `traversal_category` | Inherits from `boost::bidirectional_graph_tag`, `boost::adjacency_graph_tag`, `boost::vertex_list_graph_tag`, and `boost::edge_list_graph_tag` | The ways in which the vertices in the graph can be traversed.. |
diff --git a/BGL/examples/BGL_triangulation_2/dijkstra.cpp b/BGL/examples/BGL_triangulation_2/dijkstra.cpp
index 82e0393bbf8..3a1b061eb9e 100644
--- a/BGL/examples/BGL_triangulation_2/dijkstra.cpp
+++ b/BGL/examples/BGL_triangulation_2/dijkstra.cpp
@@ -1,103 +1,70 @@
#include
-#include
-#include
+#include
#include
-#include
+
#include
-typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
-typedef K::Point_2 Point;
+typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
+typedef K::Point_2 Point;
-typedef CGAL::Triangulation_2 Triangulation;
+typedef CGAL::Triangulation_2 Triangulation;
-// As we want to run Dijskra's shortest path algorithm we only
-// consider finite vertices and edges.
+typedef boost::graph_traits::vertex_descriptor vertex_descriptor;
+typedef boost::graph_traits::vertex_iterator vertex_iterator;
-template
-struct Is_finite {
+typedef std::map VertexIndexMap;
+typedef boost::associative_property_map VertexIdPropertyMap;
- const T* t_;
-
- Is_finite()
- : t_(NULL)
- {}
-
- Is_finite(const T& t)
- : t_(&t)
- { }
-
- template
- bool operator()(const VertexOrEdge& voe) const {
- return ! t_->is_infinite(voe);
- }
-};
-
-typedef Is_finite Filter;
-typedef boost::filtered_graph Finite_triangulation;
-typedef boost::graph_traits::vertex_descriptor vertex_descriptor;
-typedef boost::graph_traits::vertex_iterator vertex_iterator;
-
-typedef std::map VertexIndexMap;
-VertexIndexMap vertex_id_map;
-
-typedef boost::associative_property_map VertexIdPropertyMap;
-VertexIdPropertyMap vertex_index_pmap(vertex_id_map);
-
-int
-main(int argc,char* argv[])
+int main(int argc,char* argv[])
{
const char* filename = (argc > 1) ? argv[1] : "data/points.xy";
std::ifstream input(filename);
- Triangulation t;
- Filter is_finite(t);
- Finite_triangulation ft(t, is_finite, is_finite);
+ Triangulation tr;
Point p ;
- while(input >> p){
- t.insert(p);
- }
+ while(input >> p)
+ tr.insert(p);
vertex_iterator vit, ve;
+
// Associate indices to the vertices
+ VertexIndexMap vertex_id_map;
+ VertexIdPropertyMap vertex_index_pmap(vertex_id_map);
int index = 0;
- // boost::tie assigns the first and second element of the std::pair
- // returned by boost::vertices to the variables vit and ve
- for(boost::tie(vit,ve)=boost::vertices(ft); vit!=ve; ++vit ){
- vertex_descriptor vd = *vit;
- vertex_id_map[vd]= index++;
- }
+
+ for(vertex_descriptor vd : vertices(tr))
+ vertex_id_map[vd] = index++;
// Dijkstra's shortest path needs property maps for the predecessor and distance
// We first declare a vector
- std::vector predecessor(boost::num_vertices(ft));
- // and then turn it into a property map
- boost::iterator_property_map::iterator,
- VertexIdPropertyMap>
- predecessor_pmap(predecessor.begin(), vertex_index_pmap);
+ std::vector predecessor(num_vertices(tr));
- std::vector distance(boost::num_vertices(ft));
- boost::iterator_property_map::iterator,
- VertexIdPropertyMap>
+ // and then turn it into a property map
+ boost::iterator_property_map::iterator, VertexIdPropertyMap>
+ predecessor_pmap(predecessor.begin(), vertex_index_pmap);
+
+ std::vector distance(num_vertices(tr));
+ boost::iterator_property_map::iterator, VertexIdPropertyMap>
distance_pmap(distance.begin(), vertex_index_pmap);
// start at an arbitrary vertex
- vertex_descriptor source = *boost::vertices(ft).first;
+ vertex_descriptor source = *vertices(tr).first;
std::cout << "\nStart dijkstra_shortest_paths at " << source->point() <<"\n";
- boost::dijkstra_shortest_paths(ft, source,
- distance_map(distance_pmap)
- .predecessor_map(predecessor_pmap)
- .vertex_index_map(vertex_index_pmap));
+ boost::dijkstra_shortest_paths(tr, source,
+ distance_map(distance_pmap)
+ .predecessor_map(predecessor_pmap)
+ .vertex_index_map(vertex_index_pmap));
- for(boost::tie(vit,ve)=boost::vertices(ft); vit!=ve; ++vit ){
- vertex_descriptor vd = *vit;
+ for(vertex_descriptor vd : vertices(tr))
+ {
std::cout << vd->point() << " [" << vertex_id_map[vd] << "] ";
- std::cout << " has distance = " << boost::get(distance_pmap,vd)
- << " and predecessor ";
- vd = boost::get(predecessor_pmap,vd);
+ std::cout << " has distance = " << boost::get(distance_pmap,vd)
+ << " and predecessor ";
+ vd = boost::get(predecessor_pmap,vd);
std::cout << vd->point() << " [" << vertex_id_map[vd] << "]\n ";
}
- return 0;
+ return EXIT_SUCCESS;
}
diff --git a/BGL/examples/BGL_triangulation_2/dijkstra_with_internal_properties.cpp b/BGL/examples/BGL_triangulation_2/dijkstra_with_internal_properties.cpp
index 9b26686d725..b1bc089d216 100644
--- a/BGL/examples/BGL_triangulation_2/dijkstra_with_internal_properties.cpp
+++ b/BGL/examples/BGL_triangulation_2/dijkstra_with_internal_properties.cpp
@@ -1,94 +1,66 @@
#include
+
#include
#include
-#include
+#include
#include
-#include
+
#include
-typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
-typedef K::Point_2 Point;
+typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
+typedef K::Point_2 Point;
-typedef CGAL::Triangulation_vertex_base_with_id_2 Tvb;
-typedef CGAL::Triangulation_face_base_2 Tfb;
-typedef CGAL::Triangulation_data_structure_2 Tds;
-typedef CGAL::Delaunay_triangulation_2 Triangulation;
+typedef CGAL::Triangulation_vertex_base_with_id_2 Tvb;
+typedef CGAL::Triangulation_face_base_2 Tfb;
+typedef CGAL::Triangulation_data_structure_2 Tds;
+typedef CGAL::Delaunay_triangulation_2 Triangulation;
-// consider finite vertices and edges.
+typedef boost::graph_traits::vertex_descriptor vertex_descriptor;
+typedef boost::graph_traits::vertex_iterator vertex_iterator;
-template
-struct Is_finite {
+typedef boost::property_map::type VertexIdPropertyMap;
- const T* t_;
-
- Is_finite()
- : t_(NULL)
- {}
-
- Is_finite(const T& t)
- : t_(&t)
- { }
-
- template
- bool operator()(const VertexOrEdge& voe) const {
- return ! t_->is_infinite(voe);
- }
-};
-
-typedef Is_finite Filter;
-typedef boost::filtered_graph Finite_triangulation;
-typedef boost::graph_traits::vertex_descriptor vertex_descriptor;
-typedef boost::graph_traits::vertex_iterator vertex_iterator;
-
-
-int
-main(int argc,char* argv[])
+int main(int argc,char* argv[])
{
const char* filename = (argc > 1) ? argv[1] : "data/points.xy";
std::ifstream input(filename);
- Triangulation t;
- Filter is_finite(t);
- Finite_triangulation ft(t, is_finite, is_finite);
+ Triangulation tr;
- Point p ;
- while(input >> p){
- t.insert(p);
- }
+ Point p;
+ while(input >> p)
+ tr.insert(p);
- vertex_iterator vit, ve;
// associate indices to the vertices
int index = 0;
- for(boost::tie(vit,ve)=boost::vertices(ft); vit!=ve; ++vit ){
- vertex_descriptor vd = *vit;
+ for(vertex_descriptor vd : vertices(tr))
vd->id()= index++;
- }
- typedef boost::property_map::type VertexIdPropertyMap;
- VertexIdPropertyMap vertex_index_pmap = get(boost::vertex_index, ft);
+ VertexIdPropertyMap vertex_index_pmap = get(boost::vertex_index, tr);
// Dijkstra's shortest path needs property maps for the predecessor and distance
- std::vector predecessor(boost::num_vertices(ft));
+ std::vector predecessor(num_vertices(tr));
boost::iterator_property_map::iterator, VertexIdPropertyMap>
predecessor_pmap(predecessor.begin(), vertex_index_pmap);
- std::vector distance(boost::num_vertices(ft));
+ std::vector distance(num_vertices(tr));
boost::iterator_property_map::iterator, VertexIdPropertyMap>
distance_pmap(distance.begin(), vertex_index_pmap);
- vertex_descriptor source = *boost::vertices(ft).first;
+ vertex_descriptor source = *vertices(tr).first;
std::cout << "\nStart dijkstra_shortest_paths at " << source->point() << std::endl;
- boost::dijkstra_shortest_paths(ft, source ,
- distance_map(distance_pmap)
- .predecessor_map(predecessor_pmap));
+ boost::dijkstra_shortest_paths(tr, source, distance_map(distance_pmap)
+ .predecessor_map(predecessor_pmap));
- for(boost::tie(vit,ve)=boost::vertices(ft); vit!=ve; ++vit ){
- vertex_descriptor vd = *vit;
+ for(vertex_descriptor vd : vertices(tr))
+ {
std::cout << vd->point() << " [" << vd->id() << "] ";
std::cout << " has distance = " << get(distance_pmap,vd) << " and predecessor ";
+
vd = get(predecessor_pmap,vd);
std::cout << vd->point() << " [" << vd->id() << "]\n";
}
- return 0;
+
+ return EXIT_SUCCESS;
}
diff --git a/BGL/examples/BGL_triangulation_2/emst.cpp b/BGL/examples/BGL_triangulation_2/emst.cpp
index ca8282d3195..4de38c2adef 100644
--- a/BGL/examples/BGL_triangulation_2/emst.cpp
+++ b/BGL/examples/BGL_triangulation_2/emst.cpp
@@ -1,98 +1,65 @@
#include
+
#include
#include
#include
-#include
+
#include
+#include
+#include