1 #include <boost/graph/adjacency_list.hpp>
2 #include <boost/graph/astar_search.hpp>
16 typedef boost::adjacency_list<
19 boost::bidirectionalS,
25 typedef myGraph::edge_descriptor
EdgeID;
30 std::map<SgGraphNode*, VertexID>
VSlink;
37 ROSE_ASSERT(startN != NULL);
38 ROSE_ASSERT(start != NULL);
41 std::pair<std::vector<SgGraphNode*>, std::vector<SgDirectedGraphEdge*> > alledsnds =
getAllNodesAndEdges(g, start);
42 std::vector<SgGraphNode*> nods = alledsnds.first;
43 std::vector<SgDirectedGraphEdge*> eds = alledsnds.second;
44 std::set<std::pair<VertexID, VertexID> > prs;
49 for (std::vector<SgDirectedGraphEdge*>::iterator j = eds.begin(); j != eds.end(); j++) {
56 v1 = boost::add_vertex(*graph);
69 v2 = boost::add_vertex(*graph);
77 std::pair<VertexID, VertexID> pr;
80 if (prs.find(pr) == prs.end()) {
82 boost::tie(uE, ok) = boost::add_edge(v1, v2, *graph);
95 std::pair<std::vector<SgGraphNode*>, std::vector<SgDirectedGraphEdge*> > alledsnds =
getAllNodesAndEdges(g, start);
96 std::vector<SgGraphNode*> nods = alledsnds.first;
97 std::vector<SgDirectedGraphEdge*> eds = alledsnds.second;
98 std::set<std::pair<VertexID, VertexID> > prs;
103 for (std::vector<SgDirectedGraphEdge*>::iterator j = eds.begin(); j != eds.end(); j++) {
110 v1 = boost::add_vertex(*graph);
113 (*graph)[v1].sg = u1;
123 v2 = boost::add_vertex(*graph);
125 (*graph)[v2].sg = u2;
131 std::pair<VertexID, VertexID> pr;
134 if (prs.find(pr) == prs.end()) {
136 boost::tie(uE, ok) = boost::add_edge(v1, v2, *graph);
149 std::vector<SgGraphNode*> nods;
150 std::vector<SgGraphNode*> newnods;
151 std::set<SgDirectedGraphEdge*> edsnew;
152 std::vector<SgDirectedGraphEdge*> eds;
153 std::vector<SgDirectedGraphEdge*> feds;
154 std::vector<SgGraphNode*> fnods;
155 std::set<std::pair<EdgeID, EdgeID> > prs;
157 fnods.push_back(start);
158 newnods.push_back(n);
160 while (oeds.size() > 0) {
161 for (std::set<SgDirectedGraphEdge*>::iterator j = oeds.begin(); j != oeds.end(); j++) {
163 if (
find(feds.begin(), feds.end(), *j) == feds.end()) {
167 if (
find(fnods.begin(), fnods.end(), (*j)->get_to()) == fnods.end()) {
168 fnods.push_back((*j)->get_to());
170 newnods.push_back((*j)->get_to());
174 for (
unsigned int i = 0; i < newnods.size(); i++) {
176 for (std::set<SgDirectedGraphEdge*>::iterator j = oedsp.begin(); j != oedsp.end(); j++) {
177 if (
find(feds.begin(), feds.end(), *j) == feds.end()) {
194 std::pair<std::vector<SgGraphNode*>, std::vector<SgDirectedGraphEdge*> > retpr;