ogdf / ogdf

OGDF, the Open Graph Drawing Framework/Open Graph algorithms and Data structure Framework.
http://www.ogdf.net/
Other
314 stars 107 forks source link

FMMM crashes with large graphs on macOS. #67

Open svalver opened 3 years ago

svalver commented 3 years ago

Dear All,

I have been using the incredible OGDF library for a decade, and it has been an important component of my research.

Last month I detected the F3 layout in the last OGDF version does not allow processing of some large graphs. In particular, I have attached a sample network here (> 2300 nodes, see 'text.txt') and a C++ code that reproduces the bug in my machine. FMMM works when I restrict the maximum number of processed nodes to N <= 1000. But, the code issues an out of memory exception with the full set of nodes.

I am using OGDF Catalpa (2020.02) on macOS BigSur (11.1) with the latest Xcode (12.4). Shared libs are disabled, coin solver is CLP and the OGDF_MEMORY_MANAGER = MALLOC_TS (I thought that the problem was the memory manager, but it also fails with MALLOC_TS).

Many thanks in advance, Sergi

TESTING CODE:

#include <ogdf/energybased/FMMMLayout.h>
#include <ogdf/fileformats/GraphIO.h>

int main()
{
    FILE *f = fopen ("test.txt", "rt");
    if (!f) 
        return -1;
    // N =  network size
    const int N = 2356;
    int i, j;
    ogdf::node v;
    ogdf::Graph G;
    ogdf::GraphAttributes GA(G);
    // create nodes
    std::vector < ogdf::node > ref;
    for (i =0; i < N; i++) {
        v = G.newNode();
        GA.width(v) = 5;
        GA.height(v) = 5;
        ref.push_back (v);
    }
    // read links
    while (!feof(f)) {
        fscanf(f, "%d,%d\n", &i,&j);
        if (i < N && j <N) {
            G.newEdge ( ref[i], ref[j] );
        }
    }
    fclose(f);
    try {
        ogdf::FMMMLayout fmmm;
        fmmm.useHighLevelOptions(true);
        fmmm.unitEdgeLength(15.0);
        fmmm.newInitialPlacement(true);
     fmmm.qualityVersusSpeed(ogdf::FMMMOptions::QualityVsSpeed::GorgeousAndEfficient);
        fmmm.call(GA);
        printf ("fmmm ok\n");
    }
    catch (...) {
        printf("fmmm crashed\n");
    }
    return 1; 
}

NETWORK FILE: test.txt

Nheyer commented 3 years ago

you likely overflowed your stack, try increasing it with a linker flag -Wl,–stack,SIZE