To encourage people to think of tree sequences as graph objects, I think it would be helpful to add the graph representation to the "What is a Tree Sequence" tutorial, round about here. This is how you might do it:
importtskit_arg_visualizerasvizarg=viz.D3ARG.from_ts(ts=ts)
arg.set_node_labels({k: (vifkints.samples() else"") fork, vinlabels.items()})
arg.draw(
variable_edge_width=True,
y_axis_scale="time",
sample_order=sorted({k: vfork, vinlabels.items()ifkints.samples()}, key=lambdax: labels[x]))Currently this gives a plot like this:

I think a few things would be helpful to make this look simpler. In particular, if we could change the node sizes & shapes such that the internal nodes are (very) small circles and the sample nodes are square, that would match the tree-by-tree plot above it (kitchensjn/tskit_arg_visualizer#30). Allowing the y-axis ticks to be set to user-chosen values would also be helpful, I think.
Perhaps @kitchensjn has some ideas about how to make the plot friendly to a newcomer in this context?
Note that ts has been produced by code in the nodebook, like that below:
importmsprimeimportdemesdefwhatis_example():
demes_yml="""\ description: Asymmetric migration between two extant demes. time_units: generations defaults: epoch: start_size: 5000 demes: - name: Ancestral_population epochs: - end_time: 1000 - name: A ancestors: [Ancestral_population] - name: B ancestors: [Ancestral_population] epochs: - start_size: 2000 end_time: 500 - start_size: 400 end_size: 10000 migrations: - source: A dest: B rate: 1e-4 """graph=demes.loads(demes_yml)
demography=msprime.Demography.from_demes(graph)
# Choose seed so num_trees=3, tips are in same order,# first 2 trees are topologically different, and all trees have the same rootseed=12581ts=msprime.sim_ancestry(
samples={"A": 2, "B": 3},
demography=demography,
recombination_rate=1e-8,
sequence_length=1000,
random_seed=seed)
# Mutate# Choose seed to give 12 muts, last one above node 14seed=1476returnmsprime.sim_mutations(ts, rate=1e-7, random_seed=seed)
To encourage people to think of tree sequences as graph objects, I think it would be helpful to add the graph representation to the "What is a Tree Sequence" tutorial, round about here. This is how you might do it:
Currently this gives a plot like this:
I think a few things would be helpful to make this look simpler. In particular, if we could change the node sizes & shapes such that the internal nodes are (very) small circles and the sample nodes are square, that would match the tree-by-tree plot above it (kitchensjn/tskit_arg_visualizer#30). Allowing the y-axis ticks to be set to user-chosen values would also be helpful, I think.
Perhaps @kitchensjn has some ideas about how to make the plot friendly to a newcomer in this context?
Note that
tshas been produced by code in the nodebook, like that below: