Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

networkx.DiGraph import #12

Open
winni2k opened this issue Jun 23, 2020 · 2 comments
Open

networkx.DiGraph import #12

winni2k opened this issue Jun 23, 2020 · 2 comments

Comments

@winni2k
Copy link

winni2k commented Jun 23, 2020

I would like to store a sequence of trees derived from a Metropolis-Hastings MCMC sampler. This sampler stores its current state as a networkx.DiGraph object, and keeps track of how it changes the graph using a memento.

I propose the following features:

  1. a function that converts a sequence of DiGraphs into a tree sequence
  2. a class that can create a tree sequence from an initial DiGraph object and a sequence of mementos that describe successive changes to the DiGraph object, where each memento represents a sample from the MCMC chain.

In principle, one could then implement an import of arbitrary sequences of trees simply by mapping each tree in the import data to a DiGraph, and feeding those DiGraph objects into 1. I think that would reduce the amount of code needed for tree import as seen in for example #11 because it separates tree parsing from tree sequence creation.

However, my real interest is in 2., which should be more efficient than 1. because 2. would be able to easily infer what information is not redundant and therefore worth storing for each successive tree in the sequence. This would allow the construction of large tree sequences while using minimal amounts of memory and without the need for intermittent sort or simplify calls.

I welcome feedback on this proposal.

@winni2k winni2k changed the title networkx.DiGraph import networkx.DiGraph import Jun 23, 2020
@jeromekelleher
Copy link
Member

Sounds good to me @winni2k! I'm happy to look over any prototypes if you want to open a draft PR. There's no worries about dependencies etc in this repo, so just do whatever is most convenient. I'm interested to see how your mementos work.

@winni2k
Copy link
Author

winni2k commented Jun 24, 2020

Right-o.

It might be a bit of time until I get around to this, as I'm still working on another aspect of my research.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants