diff --git a/birdvisu/annotations/__init__.py b/birdvisu/annotations/__init__.py index bef0c90..667572c 100644 --- a/birdvisu/annotations/__init__.py +++ b/birdvisu/annotations/__init__.py @@ -22,7 +22,7 @@ indirections to iterating over all annotation of a particular vertex/edge. We believe that the latter is less common operation, so this seems like a good approach.""" -from ..topo_v3 import TopologyV3, VertexID, Edge +from ..topo_v3 import TopologyV3, VertexID, Edge, VertexFinder from collections import defaultdict from collections.abc import Hashable from dataclasses import dataclass, field @@ -33,6 +33,8 @@ class AnnotatedTopology: def __init__(self, topology): if not topology.frozen: raise ValueError('Can only annotate frozen topologies.') self.topology = topology + self.finder = VertexFinder() + self.finder.add_topology(topology) self.annotations: dict['AnnotatorID', 'Annotation'] = dict() # Keeping track of dependencies self.running_annotations = set() diff --git a/birdvisu/topo_v3.py b/birdvisu/topo_v3.py index f11e59f..b25ccc4 100644 --- a/birdvisu/topo_v3.py +++ b/birdvisu/topo_v3.py @@ -235,7 +235,6 @@ class Edge: # adding them to a topology. virtual: bool = False -@dataclass class VertexFinder: """Tracker of presence of vertices in topologies.