Hi,
I'm using graph-tool from both Python and C++. Normally, all works well with the dispatch function. But now I came to a situation, where I get an edge object (graph_tool.libgraph_tool_core.Edge) and want to use this from C++. Is there a way to do this?
This is the same question as: I have a function `void do_stuff(PyObject* foo)` where `foo` is a `graph_tool.libgraph_tool_core.Edge`. Can I extract the boost::detail::adj_edge_descriptor somehow (or whatever is the correct edge type)?
Kind regards Gerion
Am Montag, 7. September 2020, 22:04:36 CEST schrieb Gerion Entrup:
Hi,
I'm using graph-tool from both Python and C++. Normally, all works well with the dispatch function. But now I came to a situation, where I get an edge object (graph_tool.libgraph_tool_core.Edge) and want to use this from C++. Is there a way to do this?
This is the same question as: I have a function `void do_stuff(PyObject* foo)` where `foo` is a `graph_tool.libgraph_tool_core.Edge`. Can I extract the boost::detail::adj_edge_descriptor somehow (or whatever is the correct edge type)?
Kind regards Gerion
Found out by myself. It is actually fairly simple.
void extract_edge(PyObject* py_edge) { graph_tool::EdgeBase& edge_base = boost::python::extract<graph_tool::EdgeBase&>(py_edge); graph_tool::GraphInterface::edge_t edge = edge_base.get_descriptor()); }
Best, Gerion