Skip to content

Commit 93cd81f

Browse files
PalashLalwanimergify[bot]
authored andcommitted
added nodes time refactor code for issue no. #2766
1 parent b579afc commit 93cd81f

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@ build-gcc
33
python/benchmark/*.trees
44
python/benchmark/*.json
55
python/benchmark/*.html
6+
.venv
7+
.env
68

python/tskit/trees.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -4561,14 +4561,14 @@ def max_root_time(self):
45614561
raise ValueError(
45624562
"max_root_time is not defined in a tree sequence with 0 samples"
45634563
)
4564-
ret = max(self.node(u).time for u in self.samples())
4564+
ret = max(self.nodes_time[u] for u in self.samples())
45654565
if self.num_edges > 0:
45664566
# Edges are guaranteed to be listed in parent-time order, so we can get the
45674567
# last one to get the oldest root
45684568
edge = self.edge(self.num_edges - 1)
45694569
# However, we can have situations where there is a sample older than a
45704570
# 'proper' root
4571-
ret = max(ret, self.node(edge.parent).time)
4571+
ret = max(ret, self.nodes_time[edge.parent])
45724572
return ret
45734573

45744574
def migrations(self):

0 commit comments

Comments
 (0)