Example Sets of EdgesThe following example shows how a set of edges can be used. First a random #include <LEDA/graph/graph.h> #include <LEDA/graph/edge_set.h> using namespace leda; int main() { graph G; random_graph(G,12,15); edge_set S(G); edge e; forall_edges(e,G) S.insert(e); forall(e,S) { G.print_edge(e); std::cout << std::endl; } std::cout << std::endl; e=G.choose_edge(); G.print_edge(e); if (S.member(e)) std::cout << " is a member of S\n"; else std::cout << " is no member of S\n"; node v=G.choose_node();node w=G.choose_node(); edge f=G.new_edge(v,w); G.print_edge(f); if (S.member(f)) cout << " is a member of S\n"; else std::cout << " is no member of S\n"; return 0; } |
See also:Manual Entries: |