Skip to content

Commit

Permalink
fix: add cache for local KG
Browse files Browse the repository at this point in the history
  • Loading branch information
rememberYou committed Apr 9, 2021
1 parent 309d1aa commit 7b1a41e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pyrdf2vec/graphs/kg.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,9 @@ def _fill_hops(self, entities: Entities) -> None:
hops = self._res2hops(Vertex(entity), res)
self._entity_hops.update({entity: hops})

@cachedmethod(
operator.attrgetter("cache"), key=partial(hashkey, "_get_hops")
)
def _get_hops(self, vertex: Vertex, is_reverse: bool = False) -> List[Hop]:
"""Returns the hops of a vertex for a local Knowledge Graph.
Expand Down

0 comments on commit 7b1a41e

Please sign in to comment.