circle_graph_layout
Lays out the graph with the vertices at the points of a regular n-polygon.
Defined in: <boost/graph/circle_layout.hpp>
Example
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/circle_layout.hpp>
#include <boost/graph/topology.hpp>
#include <iostream>
#include <vector>
using namespace boost;
using Point = convex_topology<2>::point_type;
using Graph = adjacency_list<vecS, vecS, undirectedS>;
int main() {
Graph g(5);
add_edge(0, 1, g); add_edge(1, 2, g);
add_edge(2, 3, g); add_edge(3, 4, g); add_edge(4, 0, g);
std::vector<Point> positions(num_vertices(g));
auto pos_map = make_iterator_property_map(
positions.begin(), get(vertex_index, g));
circle_graph_layout(g, pos_map, 50.0);
for (auto v : make_iterator_range(vertices(g)))
std::cout << "vertex " << v << ": ("
<< positions[v][0] << ", " << positions[v][1] << ")\n";
}
vertex 0: (50, 0)
vertex 1: (15.4508, 47.5528)
vertex 2: (-40.4508, 29.3893)
vertex 3: (-40.4508, -29.3893)
vertex 4: (15.4508, -47.5528)
Positional version
template<typename VertexListGraph, typename PositionMap, typename Radius>
void circle_graph_layout(
const VertexListGraph& g,
PositionMap position,
Radius radius);
| Direction | Parameter | Description |
|---|---|---|
IN |
|
The graph object on which the algorithm will be applied. The type
|
OUT |
|
This property map is used to store the position of each vertex. The
type |
IN |
|
This is the radius of the circle on which points will be laid out.
It must be compatible with |