Example Two-Dimensional Node MapsThe following example uses a Notice that () instead of [] is used to access the entries of the matrix. #include <LEDA/graph/graph.h> #include <LEDA/graph/graph_gen.h> #include <LEDA/graph/node_map2.h> using namespace leda; int main() { graph G; random_graph(G,50,100); node_map2<bool> M(G,false); edge e; forall_edges(e,G) M(G.source(e),G.target(e))=true; forall_edges(e,G) { if (!M(G.target(e),G.source(e))) { std::cout << "Graph is not bidirected!" << std::endl; break; } } return 0; } |
See also:Associate Information with Graphs Manual Entries: |