[Lemon-user] max number of arcs in ListDigraph
Leandro Callegari Coelho
leandro.cc at gmail.com
Tue Sep 25 19:56:40 CEST 2012
Hello list,
What is the max number of arcs that a ListDigraph can take?
Take a look at the following example:
-----------------------------------------
#include <lemon/list_graph.h>
#include <lemon/network_simplex.h>
#include <unistd.h>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <limits.h>
using namespace lemon;
using namespace std;
typedef ListDigraph::Node Node;
typedef ListDigraph::Arc Arc;
typedef ListDigraph::NodeIt NodeIt;
typedef ListDigraph::ArcIt ArcIt;
ListDigraph g;
int main(int argc, char *argv[])
{
int nNodes = 5000;
ListDigraph::Node node[nNodes];
for (int i=0; i<=nNodes; ++i)
node[i] = g.addNode();
cout << "\n\t Max value of integer is " << INT_MAX << endl;
int nArcs = 2000000;
cout << "nArcs is equal to " << nArcs << endl;
ListDigraph::Arc arc[nArcs];
cout << " All arcs are defined. "<< endl;
ListDigraph::ArcMap<double> costMap(g);
ListDigraph::ArcMap<int> lowerMap(g);
ListDigraph::ArcMap<int> upperMap(g);
cout << "\n\n All is done!" << endl;
return (0);
}
------------------------------------------
if I set nArcs = 2100000, then the program crashes in ListDigraph::Arc
arc[nArcs];
In the worst case I know I would need something like 5 million arcs. It
certainly is not a limit of the int type, nor a memory issue (at this time).
Regards,
Leandro
--
LCC
"Absence of evidence is not evidence of absence"
Carl Sagan (1934 - 96)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lemon.cs.elte.hu/pipermail/lemon-user/attachments/20120925/54dd4e6f/attachment.html>
More information about the Lemon-user
mailing list