#include boostconfig.hpp #include boostgraphadjacency_list.hpp #include boostgraphgraph_utility.hpp #include boostgraphsimple_point.hpp #include boostproperty_mapproperty_map.hpp #include boostgraphcircle_layout.hpp #include boostgraphfruchterman_reingold.hpp #include boostgraphkamada_kawai_spring_layout.hpp #include iostream typedef boostsquare_topologypoint_difference_type Point; typedef boostsquare_topologypoint_type Point; struct VertexProperties { stdsize_t index; Point point; }; struct EdgeProperty { EdgeProperty(const stdsize_t &w)weight(w) {} double weight; }; typedef boostadjacency_listboostlistS, boostlistS, boostundirectedS, VertexProperties, EdgeProperty Graph; typedef boostproperty_mapGraph, stdsize_t VertexPropertiestype VertexIndexPropertyMap; typedef boostproperty_mapGraph, Point VertexPropertiestype PositionMap; typedef boostproperty_mapGraph, double EdgePropertytype WeightPropertyMap; typedef boostgraph_traitsGraphvertex_descriptor VirtexDescriptor; int main() { Graph graph; VertexIndexPropertyMap vertexIdPropertyMap = boostget(&VertexPropertiesindex, graph); for (int i = 0; i 3; ++i) { VirtexDescriptor vd = boostadd_vertex(graph); vertexIdPropertyMap[vd] = i + 2; } boostadd_edge(boostvertex(1, graph), boostvertex(0, graph), EdgeProperty(5), graph); boostadd_edge(boostvertex(2, graph), boostvertex(0, graph), EdgeProperty(5), graph); boostadd_edge(boostvertex(3, graph), boostvertex(0, graph), EdgeProperty(5), graph); boostadd_edge(boostvertex(4, graph), boostvertex(0, graph), EdgeProperty(5), graph); boostadd_edge(boostvertex(5, graph), boostvertex(0, graph), EdgeProperty(5), graph); stdcout Verticesn; boostprint_vertices(graph, vertexIdPropertyMap); stdcout Edgesn; boostprint_edges(graph, vertexIdPropertyMap); PositionMap positionMap = boostget(&VertexPropertiespoint, graph); WeightPropertyMap weightPropertyMap = boostget(&EdgePropertyweight, graph); boostcircle_graph_layout(graph, positionMap, 100); boostfruchterman_reingold_force_directed_layout(graph, positionMap, boostsquare_topology()); boostkamada_kawai_spring_layout(graph, positionMap, weightPropertyMap, boostsquare_topology(), boostside_lengthdouble(10), boostlayout_tolerance(), 1, vertexIdPropertyMap); stdcout Coordinatesn; boostgraph_traitsGraphvertex_iterator i, end; for (boosttie(i, end) = boostvertices(graph); i != end; ++i) { stdcout ID ( vertexIdPropertyMap[i] ) x positionMap[i][0] y positionMap[i][1] n; } return 0; }