简体   繁体   中英

LEDA library in cpp 'assertion' error?

I am new to C++, as well as well as LEDA. I am running a program to calculate costs of all paths available in a graph.

However, I am encountering this error:

LEDA ERROR HANDLER
    Assertion failed in file _graph.cpp at line 784: w != 0

#00 at 0x00439b27 in 
#01 at 0x00439cc2 in 
#02 at 0x00438097 in 
#03 at 0x00437cc5 in 
#04 at 0x0044290c in 
#05 at 0x00443f17 in 
#06 at 0x00444293 in 
#07 at 0x00411055 in 
#08 at 0x004219c3 in 
#09 at 0x00422421 in 
#10 at 0x00425961 in 
#11 at 0xa89e0ec5 in __libc_start_main
#12 at 0x00405169 in 

This error does not come from my code and I am quite confused about the meaning of such an error. The error occurs when I try to create a new edge in a graph between two nodes.

G.new_edge(u, v, e);   

'G' is my graph, u and v are source and target node and e is edge.

I can debug my code myself, but what confuses me is, what could this error imply?

EDIT

What the issue was:

I was reading all available target nodes 'v' from a hash map that mapped a node ID to the address of the leda_node.

In a part of my program, the hash_map was passing a null value to one of the node ID, which is why when I tried to create an edge, there was the asserting error.

It could be an internal error in Leda, but more likely the library assert fails when you pass it badly-formed input. So one of G, u, v and e will not be set up correctly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM