Closed JoOkuma closed 3 years ago
Hi Jordão,
just to be sure to understand:
FYI: I'm planning to do a refactoring of this part of the library in near future
It is closely related to the second item. I don't want to use the edge-weight for ordering. I want to give the ordering my self as an argument to build the tree.
OK I see, I plan to add this feature in the future interface. For the moment an easy way to do it is to use the ranks in your ordering as edge weights. E.g.
# complete graph with 3 vertices
g = UndirectedGraph(3)
# the edges are (in order) {0,1}, {0, 2}, and {1,2}
g.add_edges([0, 0, 1], [1, 2, 2])
# assume that we want to take edges in the following order {0,2} (rank 0), {1, 2} (rank 1) and {0,1} (rank 2)
rank_weights = [2, 0, 1]
tree, altitudes = bpt_canonical(g, rank_weights)
ok, thanks.
Hello, Benjamin
I need to build a hierarchy from an arbitrary ordering of the graph edges.
Do you think this is relevant and could be merged into the main branch?
I will probably just make a function similar to the c++
bpt_canonical
but without theedge_weights
parameter and thestable_sort
call.Best,