Graph GeneratorsLEDA provides a variety of different generators for graphs. Each generates graphs with specific properties.Purpose: The main purpose of the graph generators is to provide test graphs with specific properties for graph algorithms. There are functions to generate complete graphs and complete bipartite graphs, different random graphs and random bipartite graphs, grid graphs, and many more as well as functions to create test graphs interactively. There are also different functions to generate planar graphs based on combinatorial as well as geometric ideas. ExampleThe following small program shows how to use the graph generators. #include <LEDA/graph/graph.h> #include <LEDA/graph/graph_gen.h> using namespace leda; int main() { graph G; complete_graph(G,7); //creates complete bidirected graph with 7 nodes //there is a self loop at every node random_graph(G,5,20); //creates a random graph with 5 nodes and 20 edges maximal_planar_graph(G,10); //creates maximal planar graph with 10 nodes random_planar_graph(G,6,12); //creates random planar graph with 6 nodes and 12 edges node_array<double> xcoord(G),ycoord(G); triangulation_map(G,xcoord,ycoord,1000); //chooses 1000 random points in the unit square and returns //their triangulation as a plane map in G return 0; } |
See also:
|