Hi,
I have a large number of rooted tree graphs, however often the data has the wrong root. I am trying to re-root each graph with the correct root. Currently, Given some new root vertex I figure I can generate a new edge list using a dfs, something like:
g = g.copy()
g.set_directed(False)
edges = gt.dfs_iterator(g, <new root ind>, array = True)
# make our new graph
g2 = gt.Graph(edges, hashed = True, hash_type = 'int')
# set directed
g2.set_directed(True)
This also gives me the indicies of vertices in the original graph. What would be the best way to allow the new graph to properly inherit vertex and edge properties though, without necessarily knowing before hand necessarily which properties the original graph has?
Thanks in advance!