[#sec:make-biconnected-planar]
= make_biconnected_planar

Adds edges to a connected planar graph to make it biconnected while preserving planarity.

*Complexity:* _O(n)_ +
*Defined in:* `<boost/graph/make_biconnected_planar.hpp>`

== Example

[source,cpp]
----
include::example$algorithms/planar/make_biconnected.cpp[]
----

[,text]
----
include::example$algorithms/planar/make_biconnected.txt[]
----

== Synopsis

[source,cpp]
----
template <typename Graph, typename PlanarEmbedding,
          typename EdgeIndexMap, typename AddEdgeVisitor>
void make_biconnected_planar(
    Graph& g,
    PlanarEmbedding embedding,
    EdgeIndexMap em,
    AddEdgeVisitor& vis);
----

[cols="1,2,5"]
|===
| Direction | Parameter | Description

| IN/OUT
| `Graph& g`
| An undirected graph. The type `Graph` must be a model of
  xref:concepts/VertexListGraph.adoc[VertexListGraph],
  xref:concepts/IncidenceGraph.adoc[IncidenceGraph], and
  xref:concepts/EdgeMutableGraph.adoc[MutableGraph].

| IN
| `PlanarEmbedding embedding`
| A model of xref:concepts/property_types/PlanarEmbedding.adoc[PlanarEmbedding].

| IN
| `EdgeIndexMap em`
| A Readable Property Map that maps edges from `g` to distinct integers in the range
  `[0, num_edges(g))`. +
  *Default*: `get(edge_index, g)`

| IN
| `AddEdgeVisitor& vis`
| A model of xref:visitors/AddEdgeVisitor.adoc[AddEdgeVisitor]. +
  *Default*: `default_add_edge_visitor`, a class that defines `visit_vertex_pair` to
  dispatch its calls to `add_edge`.
|===

== Description

A graph _G_ is biconnected if, for every pair of vertices _u,v_ in _G_, there is a cycle containing both _u_ and _v_.
Alternatively, a graph is biconnected if it is connected and cannot be made disconnected by removing any single vertex.
`make_biconnected_planar` takes a xref:algorithms/planar/make_connected.adoc[connected] xref:algorithms/planar/planar_graphs.adoc[planar] graph `g` as input and adds zero or more edges to make `g` biconnected while preserving planarity.

The default behavior of `make_biconnected_planar` is to modify the graph `g` by calling `add_edge(u,v,g)` for every pair of vertices _(u,v)_ where an edge needs to be added to make `g` biconnected.
This behavior can be overridden by providing a visitor as the `AddEdgeVisitor` parameter.
The only requirement for an `AddEdgeVisitor` is that it define a member function with the following signature:

[source,cpp]
----
template <typename Graph, typename Vertex>
void visit_vertex_pair(Vertex u, Vertex v, Graph& g);
----

This event point can also be used as a hook to update the underlying edge index map automatically as edges are added.
See the documentation for the xref:visitors/AddEdgeVisitor.adoc[AddEdgeVisitor] concept for more information.

See also link:../example/make_biconnected_planar.cpp[`example/make_biconnected_planar.cpp`].

