You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The random_labeled_tree function is the recommended replacement for the deprecated random_tree fn, but it doesn't support the create_using kwarg. AFAICT, the only way to replicate the current behavior of random_tree is to create a DiGraph from the generated edges manually:
I'm mostly just raising for visibility - I don't recall if this was an explicit decision to remove create_using support - @vigna . From a user perspective it'd be convenient to be able to replicate existing functionality with as little code modification as possible.
The text was updated successfully, but these errors were encountered:
To summarize (hopefully correctly). There are multiple ways to define uniformly chosen random directed trees in the literature. Even the definition of a directed tree varies (arborescence vs polytree for example, see wikipedia trees). Each definition of directed tree has a different set of probabilities due to different restrictions on directions of edges. So, if we want random directed trees we should at least use separate functions for them -- and probably multiple separate functions.
The above-linked comments do mention that we could include an example in the doc_string for turning the random tree into a DFS-oriented directed tree (an arborescence). I don't see that. But I suspect that is probably the best way to help users who want to replicate what was previously available via random_tree with create_using=DiGraph. It might also be good to mention the difficulty in defining a uniformly chosen random directed tree, though it might be hard to write it in a short yet understandable manner.
The deprecated
random_tree
function supported thecreate_using
kwarg to allow the creation of directed trees:The
random_labeled_tree
function is the recommended replacement for the deprecatedrandom_tree
fn, but it doesn't support thecreate_using
kwarg. AFAICT, the only way to replicate the current behavior ofrandom_tree
is to create a DiGraph from the generated edges manually:I'm mostly just raising for visibility - I don't recall if this was an explicit decision to remove
create_using
support - @vigna . From a user perspective it'd be convenient to be able to replicate existing functionality with as little code modification as possible.The text was updated successfully, but these errors were encountered: