31.01.2014 Views

Version 5.0 The LEDA User Manual

Version 5.0 The LEDA User Manual

Version 5.0 The LEDA User Manual

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

11.22 Graph Generators ( graph gen )<br />

void complete graph(graph& G, int n)<br />

void complete ugraph(graph& G, int n)<br />

creates a complete graph G with n nodes.<br />

creates a complete undirected graph G with n nodes.<br />

void random graph noncompact(graph& G, int n, int m)<br />

generates a random graph with n nodes and m edges.<br />

No attempt is made to store all edges in the same<br />

adjacency list consecutively. This function is only included<br />

for pedagogical reasons.<br />

void<br />

random graph(graph& G, int n, int m, bool no anti parallel edges,<br />

bool loopfree, bool no parallel edges)<br />

generates a random graph with n nodes and m edges.<br />

All edges in the same adjacency list are stored consecutively.<br />

If no parallel edges is true then no parallel edges are<br />

generated, if loopfree is true then no self loops are<br />

generated, and if no anti parallel edges is true then<br />

no anti parallel edges are generated.<br />

void random graph(graph& G, int n, int m)<br />

void random simple graph(graph& G, int n, int m)<br />

same as random graph(G, n, m, false, false, false).<br />

same as random graph(G, n, m, false, false, true).<br />

void random simple loopfree graph(graph& G, int n, int m)<br />

same as random graph(G, n, m, false, true, true).<br />

void random simple undirected graph(graph& G, int n, int m)<br />

void random graph(graph& G, int n, double p)<br />

void test graph(graph& G)<br />

same as random graph(G, n, m, true, true, true).<br />

generates a random graph with n nodes. Each edge<br />

of the complete graph with n nodes is included with<br />

probability p .<br />

creates interactively a user defined graph G.<br />

void complete bigraph(graph& G, int a, int b, list& A, list& B)<br />

creates a complete bipartite graph G with a nodes on<br />

side A and b nodes on side B. All edges are directed<br />

from A to B.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!