Hi,

I got a strange problem. I have this code (simplified, the Graph represented by 
graph_tool is a control flow graph):
```
class CFG(graph_tool.Graph):
    def get_function_bbs(self, function):
        print(self.vertex(function))
        for edge in self.vertex(function).out_edges():
            print(edge.__dict__)
            print(edge)
            if self.ep.type[edge] == CFType.f2b:
                yield edge.target()
```

Calling the function `get_function_bbs` now leads to a `ValueError: invalid 
edge descriptor`. The stack trace says the `print(edge)` instruction is 
responsible for the error:
```
File "/.../graph.py", line 93, in get_function_bbs
    print(edge)
ValueError: invalid edge descriptor
```

In my tests the function is called many times. This is the output (--- 
indicates a new call of get_function_bbs)
```
---
12
{}
(12, 13)
---
24
{}
(24, 25)
---
40
{}
(40, 41)
---
71
{}
(71, 72)
{}
(71, 73)
{}
```

So: `71` is the vertex, where the functions fails. There are two edges `(71, 
72)` and `(71, 73)` where the descriptor is valid and another unknown edge that 
is _not_ valid.
All edge descriptors have no dict.

My question: How can I debug this and find out, why it is invalid? Can I 
do/print anything in Python? Should I use GDB? Where would be a good place to 
set a breakpoint?

I cannot print the faulty edge. It is fairly complicate to make an minimal 
example. My whole code uses no remove_edge() or remove_vertex(). I'm using 
graph_tool 2.43.

Best,
Gerion

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
graph-tool mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to