Skip to content

Add docstring example for directed tree. - #7449

Merged
dschult merged 1 commit into
networkx:mainfrom
rossbar:random-tree-directed-example
May 21, 2024
Merged

dschult merged 1 commit into
networkx:mainfrom
rossbar:random-tree-directed-example

Conversation

@rossbar

@rossbar rossbar commented May 15, 2024

Copy link
Copy Markdown
Contributor

Closes #7410

@dschult dschult left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want to create what was provided prior to #7410 we could add another example like:

DG = nx.DiGraph(nx.dfs_edges(G, source=0))

But I think we decided that this approach did not produce uniformly random directed trees on pretty much any set of directed trees one might consider.

So, I put that example here in the PR instead of in the doc_string. A dedicated user who wants to reproduce the previous behavior badly enough can use that one-liner. But we're not going to advertise it for general (or new) users.

My only suggestion is maybe we should use G.edges inside nx.DiGraph.

Thanks @rossbar

@dschult
dschult merged commit e0e7c7d into networkx:main May 21, 2024
@jarrodmillman jarrodmillman added this to the 3.4 milestone May 21, 2024
cvanelteren pushed a commit to cvanelteren/networkx that referenced this pull request May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

Can't replicate directed functionality of deprecated random_tree

3 participants