boost-graph

Lengauer Tarjan Algorithm in BGL (boost graph library)

白昼怎懂夜的黑 提交于 2019-12-11 12:13:03
问题 I need to create a dominator tree for a given graph. The code I have compiles and runs without errors, but the output looks exactly the same as the input. I have defined the following type for my graph (to be analyzed) typedef boost::adjacency_list<boost::listS, boost::vecS, boost::bidirectionalS, vertex_info, edge_info> Graph; and I would like to have another object containing the corresponding dominator tree. I tried the following: // dominator tree is an empty Graph object dominator_tree =

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:/

BGL: Example of isomorphism with vertex invariants

元气小坏坏 提交于 2019-12-11 10:24:35
问题 can someone show me an example of how to use the Boost Graph Library isomorphism function with vertex invariants? I'm looking at the example at http://www.boost.org/doc/libs/1_50_0/libs/graph/example/isomorphism.cpp, which uses degree_vertex_invariant(). However, I want to define my own invariant function and an example would really help me to understand how to do this. Here are some more details: I am defining a set of discrete attributes on vertices such that I can label each vertex with an

BGL Interior properties for implicit graph

二次信任 提交于 2019-12-11 10:06:24
问题 I'm trying to use the A* search from Boost BGL on an implicit graph. I have implemented my own graph type which models the concept of Graph and IncidenceGraph. According to the documentation of A*, I should be using the astar_search_no_init function with implicit graphs. Just to get the whole thing working, I have tried to implement dummy versions of all of the needed concepts. This includes the graph, the visitor, the heuristic and the vertex type. My main function looks like this int main()

set the number of vertices in boost:graph

家住魔仙堡 提交于 2019-12-11 09:08:46
问题 Given an empty boost::graph g, I want to set the number of vertices in this graph and add some edges then. But from the documentation, I cannot find related functions. All examples I found defines the size of vertices in initialization (like Graph g(10) defines a graph with 10 vertices). But I don't know the size when I define the graph. I want to first define a Graph g, and set the size later. 回答1: The simplest approach is to call the boost::add_vertex( graph ) method for each vertex you

if add_vertex in BGL checks for the existence of the vertex

99封情书 提交于 2019-12-11 08:43:05
问题 In BGL, add_edge checks if the edge already exists. Is there the same mechanism for add_vertex ? For example, if we have a vertex with some bundled_properties , and then we add it to the graph, and then connect an edge to it, would be this vertex duplicated if there was a similar vertex? 回答1: When two vertices have similar properties (internal, or bundled) they are the same vertex, and add_vertex instead of adding it with new index shouldn't just return the index to an existing one? – Bruce

Boost Read_graphml doesn't read xml properly it gives all the vertices but they are empty

倾然丶 夕夏残阳落幕 提交于 2019-12-11 07:58:30
问题 I have a adjacency list of type boost::adjacency_list<boost::setS, boost::vecS, boost::directedS, GraphData> Where GraphData is a structure contains name struct GraphItem { std::string Name; } I am able to write graph to xml void WriteGraph() { boost::dynamic_properties dp; dp.property("Name", make_transform_value_property_map(&Name, boost::get(vertex_bundle, graph))); boost::write_graphml(filename, graph, dp, true); } std::string Name(boost::vertex_bundle_type<Graph>::type v) { std:

Do property maps remain necessary for BGL?

做~自己de王妃 提交于 2019-12-11 07:37:39
问题 After declaring std::map<std::string, std::string> M it's possible to: Write to the map: M["Jack"] = "323 Union St"; Read from the map: std::cout << M["Jack"]; And yet after declaring boost::associative_property_map<std::map<std::string, std::string>> PM(M) we are not able to do much more than: Write to the property map: boost::put(PM, "Fred", "323 Union St"); Read from the property map: boost::get(PM, "Fred"); What can you do with a property map that you cannot already do with a map? Context

Boost Graph read_graphml & dynamic vertex properties

…衆ロ難τιáo~ 提交于 2019-12-11 05:23:46
问题 I have use the boost graph library and read in a graph from a graphml such as this: <?xml version="1.0" encoding="UTF-8"?> <graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd"> <graph id="G" edgedefault="directed"> <node id="A"/> <node id="B"/> <edge id="0" source="A" target="B"> </graph> </graphml> I have the following C++

adding an external property to include index for vertix in graph (boost)

烂漫一生 提交于 2019-12-11 05:09:23
问题 I'm trying to use an associative_property_map to include index for vertices, but I get the following error with the following simple code, what is the problem ? #include <boost/graph/iteration_macros.hpp> #include <boost/graph/adjacency_list.hpp> using namespace std; using namespace boost; struct NodeData { int label; }; struct EdgeData { int age; }; typedef map<vecS, size_t> IndexMap; IndexMap mapIndex; associative_property_map<IndexMap> propmapIndex(mapIndex); typedef adjacency_list<setS,