Let AnnotatedTopology have a VertexFinder attached

Annotators may want to match vertices based on partial information.
Especially, with split visualisation.ospf, we want to be able to match
for networks even without the full details (like DRs or all the
current prefixes.)

This finally uses the VertexFinder :-) Also, it is definitely not a
dataclass, who wrote that? ;-)
ann_interfaces
LEdoian 1 year ago
parent 57f148d50d
commit 923b523e84

@ -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()

@ -235,7 +235,6 @@ class Edge:
# adding them to a topology.
virtual: bool = False
@dataclass
class VertexFinder:
"""Tracker of presence of vertices in topologies.

Loading…
Cancel
Save