내가 boost.I가 중복 질문부스트
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/graphviz.hpp>
struct my_graph_writer {
void operator()(std::ostream& out) const {
out << "graph [bgcolor=lightgrey]" << std::endl;
out << "node [shape=circle color=blue]" << std::endl;
out << "edge [color=red]" << std::endl;
}
} myGraphWrite;
int main()
{
using namespace boost;
typedef adjacency_list<vecS, vecS, directedS, no_property, int> Graph;
Graph g;
add_edge(0, 1, 123, g);
std::ofstream gout;
gout.open("graphname.dot");
write_graphviz(gout,g,my_graph_writer);
}
에 대한 노드와 edge.i'm 점점 컴파일 error.sorry의 속성을 변경하려면 사용하여 그래프를 만들려고을 사용하여 그래프의 노드를 색칠하는 방법
다음과 같이 수정되었습니다.하지만 주먹 노드가 변경되지 않습니다. 문제가 있습니까?
#include <iostream>
#include <boost/graph/graphviz.hpp>
using namespace boost;
typedef adjacency_list< listS, vecS, directedS > digraph;
// define a property writer to color the edges as required
class color_writer {
public:
// constructor - needs reference to graph we are coloring
color_writer(digraph& g) : myGraph(g) {}
// functor that does the coloring
template <class VertexOrEdge>
void operator()(std::ostream& out, const VertexOrEdge& e) const {
out << "graph [bgcolor=lightgrey]" << std::endl;
out << "node [shape=Mrect color=blue]" << std::endl;
out << "edge [color=red]" << std::endl;
}
private:
digraph& myGraph;
};
int main()
{
using namespace std;
// instantiate a digraph object with 8 vertices
digraph g;
// add some edges
add_edge(0, 1, g);
add_edge(1, 5, g);
add_edge(5, 6, g);
add_edge(2, 3, g);
add_edge(2, 4, g);
boost::write_graphviz(f, g,color_writer(g));
return 0;
}
내가 above.but 주먹 노드로 수정이 뭐야가 문제가 변경되지 –
도 방문 정점의 색상을 변경하는 방법? –