Skip to content

Commit

Permalink
fix networkx import
Browse files Browse the repository at this point in the history
  • Loading branch information
ericz1803 authored and erikyao committed Oct 19, 2023
1 parent adc7b72 commit ff98a8f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions biothings/hub/datatransform/datatransform_mdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# pylint: disable=E0401, E0611
import copy

from networkx import all_shortest_paths, all_simple_paths, nx
import networkx as nx
from pymongo.collation import Collation

import biothings.utils.mongo as mongo
Expand Down Expand Up @@ -228,7 +228,7 @@ def _precompute_paths(self):
self.paths = {}
for output_type in self.output_types:
for input_type in self.input_types:
paths = [p for p in all_simple_paths(self.graph, input_type[0], output_type)]
paths = [p for p in nx.all_simple_paths(self.graph, input_type[0], output_type)]
if not paths:
try:
# this will try to find self-loops. all_shortest_paths() return one element,
Expand All @@ -239,7 +239,7 @@ def _precompute_paths(self):
# p-to-p isn't defined
# pylint: disable=W0104
self.graph.edges[input_type[0], output_type]
paths = [p*2 for p in all_shortest_paths(
paths = [p*2 for p in nx.all_shortest_paths(
self.graph, input_type[0], output_type)]
except KeyError:
pass
Expand Down

0 comments on commit ff98a8f

Please sign in to comment.