I have a connected graph A (level 0) and I want to populate the next level with graphs B,C,D... by iteratively removing one edge at a time in A. Here is how my code begins:
struct VertexData
{
long ID;
};
typedef boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS,VertexData, property< edge_index_t, int > >> SimpleGraph;
typedef boost::graph_traits<SimpleGraph>::vertex_descriptor vertex_t;
typedef boost::graph_traits<SimpleGraph>::edge_descriptor edge_t;
int main(){
SimpleGraph A;
}
I have tried looping over the edges of A and removing an edge at a time after having copied graph A:
SimpleGraph tempStructure;
vector<SimpleGraph> newStructures;
vector<long> parentList;
// loop over the edges
auto es = boost::edges(A);
pred = A.ID;
for (auto eit = es.first; eit != es.second; ++eit){
// 1. copy structure
cout << "Copy structure." <<endl;
boost::copy_graph(A, tempStructure);
// 2. remove a particular edge
cout << "Remove edge." << endl;
boost::remove_edge(*eit, tempStructure);
// 3. save structure
cout << "Saving structure." << endl;
newStructures.push_back(tempStructure);
// 4. save parent of old structure]
cout << "Saving parent." << endl;
parentList.push_back(pred);
}
But as I have read here, I understand this is a very naive attempt. I have found the following solution ( Boost filtered graph with blacklisted edges) and seen that a filtered graph seems the way to go. However, I am having trouble implementing it...
Is it possible to filter out one edge at a time in the parent graph so that the children graphs are filtered versions of A that lack one edge in A?