Ticket #4087: fruchterman_reingold_force_directed_layout error.txt

File fruchterman_reingold_force_directed_layout error.txt, 8.1 KB (added by Wolfgang Forstmeier <wolfgang.forstmeier@…>, 13 years ago)
Line 
1#include <boost/config.hpp>
2#include <boost/graph/adjacency_list.hpp>
3#include <boost/graph/graph_utility.hpp>
4#include <boost/graph/simple_point.hpp>
5#include <boost/property_map/property_map.hpp>
6#include <boost/graph/circle_layout.hpp>
7#include <boost/graph/fruchterman_reingold.hpp>
8#include <boost/graph/kamada_kawai_spring_layout.hpp>
9#include <iostream>
10
11//typedef boost::square_topology<>::point_difference_type Point;
12typedef boost::square_topology<>::point_type Point;
13
14struct VertexProperties
15{
16 std::size_t index;
17 Point point;
18};
19
20struct EdgeProperty
21{
22 EdgeProperty(const std::size_t &w):weight(w) {}
23 double weight;
24};
25
26
27typedef boost::adjacency_list<boost::listS,
28boost::listS, boost::undirectedS,
29VertexProperties, EdgeProperty > Graph;
30
31typedef boost::property_map<Graph, std::size_t VertexProperties::*>::type VertexIndexPropertyMap;
32typedef boost::property_map<Graph, Point VertexProperties::*>::type PositionMap;
33typedef boost::property_map<Graph, double EdgeProperty::*>::type WeightPropertyMap;
34
35typedef boost::graph_traits<Graph>::vertex_descriptor VirtexDescriptor;
36
37int main()
38{
39 Graph graph;
40
41 VertexIndexPropertyMap vertexIdPropertyMap = boost::get(&VertexProperties::index, graph);
42
43 for (int i = 0; i < 3; ++i) {
44 VirtexDescriptor vd = boost::add_vertex(graph);
45 vertexIdPropertyMap[vd] = i + 2;
46 }
47
48 boost::add_edge(boost::vertex(1, graph), boost::vertex(0, graph), EdgeProperty(5), graph);
49 boost::add_edge(boost::vertex(2, graph), boost::vertex(0, graph), EdgeProperty(5), graph);
50// boost::add_edge(boost::vertex(3, graph), boost::vertex(0, graph), EdgeProperty(5), graph);
51// boost::add_edge(boost::vertex(4, graph), boost::vertex(0, graph), EdgeProperty(5), graph);
52// boost::add_edge(boost::vertex(5, graph), boost::vertex(0, graph), EdgeProperty(5), graph);
53
54 std::cout << "Vertices\n";
55 boost::print_vertices(graph, vertexIdPropertyMap);
56
57 std::cout << "Edges\n";
58 boost::print_edges(graph, vertexIdPropertyMap);
59
60 PositionMap positionMap = boost::get(&VertexProperties::point, graph);
61 WeightPropertyMap weightPropertyMap = boost::get(&EdgeProperty::weight, graph);
62
63 //boost::circle_graph_layout(graph, positionMap, 100);
64 boost::fruchterman_reingold_force_directed_layout(graph, positionMap, boost::square_topology<>());
65
66 /*
67 boost::kamada_kawai_spring_layout(graph, positionMap, weightPropertyMap,
68 boost::square_topology<>(), boost::side_length<double>(10), boost::layout_tolerance<>(),
69 1, vertexIdPropertyMap);
70 */
71
72 std::cout << "Coordinates\n";
73 boost::graph_traits<Graph>::vertex_iterator i, end;
74 for (boost::tie(i, end) = boost::vertices(graph); i != end; ++i) {
75 std::cout << "ID: (" << vertexIdPropertyMap[*i] << ") x: " << positionMap[*i][0] << " y: " << positionMap[*i][1] << "\n";
76 }
77
78 return 0;
79}
80
81
82/*
83
841>------ Build started: Project: GraphTest, Configuration: Debug Win32 ------
851>Compiling...
861>GraphTest.cpp
871>d:\sourcen\boost_1_42_0\boost\property_map\property_map.hpp(355) : error C2678: binary '+' : no operator found which takes a left-hand operand of type 'const std::_Vector_iterator<_Ty,_Alloc>' (or there is no acceptable conversion)
881> with
891> [
901> _Ty=PointDiff,
911> _Alloc=std::allocator<PointDiff>
921> ]
931> d:\sourcen\boost_1_42_0\boost\graph\topology.hpp(56): could be 'boost::convex_topology<Dims>::point_difference boost::operator +(const boost::convex_topology<Dims>::point_difference &,const boost::convex_topology<Dims>::point_difference &)' [found using argument-dependent lookup]
941> with
951> [
961> Dims=2
971> ]
981> c:\program files\microsoft visual studio 8\vc\include\vector(366): or 'std::_Vector_iterator<_Ty,_Alloc> std::_Vector_iterator<_Ty,_Alloc>::operator +(__w64 int) const'
991> with
1001> [
1011> _Ty=PointDiff,
1021> _Alloc=std::allocator<PointDiff>
1031> ]
1041> while trying to match the argument list '(const std::_Vector_iterator<_Ty,_Alloc>, const boost::detail::error_property_not_found)'
1051> with
1061> [
1071> _Ty=PointDiff,
1081> _Alloc=std::allocator<PointDiff>
1091> ]
1101> d:\sourcen\boost_1_42_0\boost\property_map\property_map.hpp(355) : while compiling class template member function 'boost::convex_topology<Dims>::point_difference boost::iterator_property_map<RandomAccessIterator,IndexMap,T,R>::operator [](void *) const'
1111> with
1121> [
1131> Dims=2,
1141> RandomAccessIterator=std::_Vector_iterator<PointDiff,std::allocator<PointDiff>>,
1151> IndexMap=boost::adj_list_vertex_property_map<Graph,boost::detail::error_property_not_found,const boost::detail::error_property_not_found &,boost::vertex_index_t>,
1161> T=boost::convex_topology<2>::point_difference,
1171> R=boost::convex_topology<2>::point_difference &
1181> ]
1191> d:\sourcen\boost_1_42_0\boost\graph\fruchterman_reingold.hpp(392) : see reference to class template instantiation 'boost::iterator_property_map<RandomAccessIterator,IndexMap,T,R>' being compiled
1201> with
1211> [
1221> RandomAccessIterator=std::_Vector_iterator<PointDiff,std::allocator<PointDiff>>,
1231> IndexMap=boost::adj_list_vertex_property_map<Graph,boost::detail::error_property_not_found,const boost::detail::error_property_not_found &,boost::vertex_index_t>,
1241> T=boost::convex_topology<2>::point_difference,
1251> R=boost::convex_topology<2>::point_difference &
1261> ]
1271> d:\sourcen\boost_1_42_0\boost\graph\fruchterman_reingold.hpp(421) : see reference to function template instantiation 'void boost::detail::fr_force_directed_layout<boost::detail::error_property_not_found>::run<Topology,Graph,PositionMap,boost::square_distance_attractive_force,boost::square_distance_repulsive_force,boost::grid_force_pairs<Topology,PositionMap>,boost::linear_cooling<T>,boost::square_distance_attractive_force,boost::attractive_force_t,boost::no_property>(const Graph &,PositionMap,const Topology &,AttractiveForce,RepulsiveForce,ForcePairs,Cooling,boost::detail::error_property_not_found,const boost::bgl_named_params<boost::square_distance_attractive_force,Tag,Base> &)' being compiled
1281> with
1291> [
1301> Topology=boost::square_topology<>,
1311> Graph=Graph,
1321> PositionMap=PositionMap,
1331> T=double,
1341> AttractiveForce=boost::square_distance_attractive_force,
1351> RepulsiveForce=boost::square_distance_repulsive_force,
1361> ForcePairs=boost::grid_force_pairs<boost::square_topology<>,PositionMap>,
1371> Cooling=boost::linear_cooling<double>,
1381> Tag=boost::attractive_force_t,
1391> Base=boost::no_property
1401> ]
1411> d:\sourcen\boost_1_42_0\boost\graph\fruchterman_reingold.hpp(433) : see reference to function template instantiation 'void boost::fruchterman_reingold_force_directed_layout<Topology,Graph,PositionMap,boost::square_distance_attractive_force,boost::attractive_force_t,boost::no_property>(const Graph &,PositionMap,const Topology &,const boost::bgl_named_params<T,Tag,Base> &)' being compiled
1421> with
1431> [
1441> Topology=boost::square_topology<>,
1451> Graph=Graph,
1461> PositionMap=PositionMap,
1471> T=boost::square_distance_attractive_force,
1481> Tag=boost::attractive_force_t,
1491> Base=boost::no_property
1501> ]
1511> d:\sourcen\test\c++\graphtest\graphtest.cpp(64) : see reference to function template instantiation 'void boost::fruchterman_reingold_force_directed_layout<boost::square_topology<>,Graph,PositionMap>(const Graph &,PositionMap,const Topology &)' being compiled
1521> with
1531> [
1541> Graph=Graph,
1551> PositionMap=PositionMap,
1561> Topology=boost::square_topology<>
1571> ]
1581>Build Time 0:04
1591>Build log was saved at "file://d:\Sourcen\Test\C++\GraphTest\Debug\BuildLog.htm"
1601>GraphTest - 1 error(s), 0 warning(s)
161========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
162
163
164*/