i1 : A000088 = apply(1..9, n -> #generateGraphs n) o1 = (1, 2, 4, 11, 34, 156, 1044, 12346, 274668) o1 : Sequence |
i2 : B = apply(1..12, n -> generateGraphs(n, OnlyBipartite => true)); |
Further, we can use filterGraphs to refine the set of generate graphs for deeper properties.
i3 : forestsOnly = buildGraphFilter {"NumCycles" => 0}; |
i4 : A005195 = apply(B, graphs -> #filterGraphs(graphs, forestsOnly)) o4 = (1, 2, 3, 6, 10, 20, 37, 76, 153, 329, 710, 1601) o4 : Sequence |
i5 : treesOnly = buildGraphFilter {"NumCycles" => 0, "Connectivity" => 0, "NegateConnectivity" => true}; |
i6 : A000055 = apply(B, graphs -> #filterGraphs(graphs, treesOnly)) o6 = (1, 1, 1, 2, 3, 6, 11, 23, 47, 106, 235, 551) o6 : Sequence |
i7 : connected = buildGraphFilter {"Connectivity" => 0, "NegateConnectivity" => true}; |
i8 : prob = n -> log(n)/n; |
i9 : apply(2..30, n -> #filterGraphs(generateRandomGraphs(n, 100, 2*(prob n)), connected)) o9 = (65, 90, 89, 96, 94, 95, 96, 97, 95, 97, 98, 99, 100, 99, 97, 99, 98, ------------------------------------------------------------------------ 100, 98, 99, 98, 97, 98, 98, 97, 99, 100, 97, 97) o9 : Sequence |
i10 : apply(2..30, n -> #filterGraphs(generateRandomGraphs(n, 100, (prob n)/2), connected)) o10 = (29, 8, 4, 5, 3, 4, 1, 0, 1, 1, 2, 2, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, ----------------------------------------------------------------------- 1, 0, 0, 0, 0, 1) o10 : Sequence |