Winfred Huang
Winfred Huang

Reputation: 372

Should I use filtered graph or subgraph or something else?

I am using BGL recently, and I have a graph G now. I need a data structure that can rule out one vertex at a time, without breaking the original graph. What should I do?
At first I found the filtered graph, but I need to label all vertices, and create a new filtered graph after I rule out a vertex. If I have N vertices in the graph, I need to filter N times.
I also thought of a subgraph, but it doesn't support removing vertices.

Upvotes: 1

Views: 240

Answers (1)

sehe
sehe

Reputation: 393354

You can use a filtered graph.

You can have a dynamic filter predicate that incrementally filters out more vertices. No need to create more filtered graphs at all.

See an example:

Upvotes: 1

Related Questions