I am trying to integrate a boost graph implementation of Tarjan's optimal branching algorithm with graph_tool

The code is in pure C++ and I want to wrap it using boost python.

The ultimate goal is I can pass in a `graph_tool.Graph` instance to the wrapped function directly.

For example:

from graph_tool.generation import complete_graph
from pyedmond import optimal_branching  # suppose I made it already, pyedmond is the name of the module after  wrapping

g = complete_graph(1000, directed=True)
optimal_branching(g) # it runs and give the correct result.


My attempt (with code example):

instead of using `graph_tool.Graph`, I created another graph type using boost graph (in C++), say the name is `MyGraph`.

Then I pass the edges and weights in `graph_tool.Graph` (in Python) to `MyGraph` (in C++) via boost python so that a new MyGraph is created.

Last I pass in the MyGraph instance to the optimal  branching function in C++.

I do this "graph copying" because `graph_tool.Graph` does not match the signature of the optimal branching function, which requires:

boost::adjacency_list<boost::listS, boost::vecS, boost::directedS, boost::no_property, boost::property<boost::edge_weight_t, double, boost::no_property>, boost::no_property, boost::listS>


My question is:

Can I circumvent the graph copying procedure?