boost-property-map

Dijkstra graph with a table of weights on each edge

混江龙づ霸主 提交于 2020-01-19 05:19:27
问题 I have a boost graph with multiples weights for each edges (imagine one set of weights per hour of the day). Every one of those weights values is stored in a propretyEdge class : class propretyEdge { std::map<std::string,double> weights; // Date indexed } I created a graph with those properties, and then filled it with the right values. The problem is now that I want to launch the Dijkstra algorithm over a particular set of weight on the graph : for example a function that could be : void

External property map tied to std::vector in boost graph library

微笑、不失礼 提交于 2020-01-04 14:16:28
问题 I am currently trying to define external properties of a boost graph. I use some bundled properties as internal ones: struct VertexProperties { int demand; }; struct EdgeProperties { uint capacity; int cost; }; typedef adjacency_list <vecS, vecS, bidirectionalS, VertexProperties, EdgeProperties> Graph; However, during the algorithm I need some external properties, that is I want to be able to map edges/vertices of my graph to elements stored in a std::vector in such a way that I can access

Is it possible to have several edge weight property maps for one graph?

你离开我真会死。 提交于 2019-12-29 08:15:25
问题 How would I create a graph, such that the property map (weight of edges) is different in each property map? Is it possible to create such a property map? Like an array of property maps? I have not seen anyone on the Internet using it, could I have an example? Graph g(10); // graph with 10 nodes cin>>a>>b>>weight1>>weight2>>weight3>>weight4; and put each weight in a property map. 回答1: You can compose a property map in various ways. The simplest approach would seem something like: Using C++11

Writing boost dynamic properties to a file using Boost Graph Library

别来无恙 提交于 2019-12-23 20:26:00
问题 I have already asked a question here about using Boost Graph Library and writing graph into file. Due to change in my requirements, I need to write dynamic graph properties into a DOT file. After some look up, I managed to come up with some code but it does not work. Below is what I have done so far: Map class uses the Cell class as vertices and Cell class uses a separate CellProperty class for setting and getting all the Cell properties. And finally Map class where I build the graph and try

What is a property map in BOOST?

北慕城南 提交于 2019-12-20 09:47:12
问题 Can someone explain to a Boost beginner like me what is a property map is in Boost? I came across this when trying to use the BGL for calculating strong connected components. I went throw the documentation for the property map and graph module and still don't know what to make of it. Take this code, for example: - what is the make_iterator_property_map function doing? - and what is the meaning of this code: get(vertex_index, G) ? #include <boost/config.hpp> #include <vector> #include

Weight map as function in Boost Graph Dijkstra algorithm

眉间皱痕 提交于 2019-12-18 06:53:58
问题 I'm using Boost Graph Libraries and need to use a weightmap which is not constant, but which is a function of a parameter K (i.e. the edge costs depend on K). In practice, given the following code: #include <boost/config.hpp> #include <iostream> #include <fstream> #include <boost/graph/graph_traits.hpp> #include <boost/graph/dijkstra_shortest_paths.hpp> #include <boost/graph/adjacency_list.hpp> struct Edge { Edge(float weight_) : weight(weight_) {} float weight; float getWeight(int K) {

Weight map as function in Boost Graph Dijkstra algorithm

旧时模样 提交于 2019-12-18 06:52:12
问题 I'm using Boost Graph Libraries and need to use a weightmap which is not constant, but which is a function of a parameter K (i.e. the edge costs depend on K). In practice, given the following code: #include <boost/config.hpp> #include <iostream> #include <fstream> #include <boost/graph/graph_traits.hpp> #include <boost/graph/dijkstra_shortest_paths.hpp> #include <boost/graph/adjacency_list.hpp> struct Edge { Edge(float weight_) : weight(weight_) {} float weight; float getWeight(int K) {

Unable to use integer edge weights with Kamada-Kawai layout

烂漫一生 提交于 2019-12-11 10:28:44
问题 The question started here, but after all the updates it is already a different question with a different title. My Graph type is defined as follows: using Graph = boost::adjacency_list<vecS, setS, undirectedS, State, CostType>; where CostType happens to be int . I am trying to obtain the Kamada-Kawai spring layout as follows: template <class PointMap> PointMap layout() const { PointMap res; boost::associative_property_map<PointMap> temp(res); circle_graph_layout(g_, temp, 10.0); // https:/