Skip to content

Commit

Permalink
Update inference.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jaydu1 committed Apr 20, 2024
1 parent 37e9f3d commit af881b0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions VITAE/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,13 @@ def build_milestone_net(self, subgraph, init_node: int):
elif nx.is_directed_acyclic_graph(subgraph):
milestone_net = []
for edge in list(subgraph.edges):
paths = nx.all_simple_paths(G, source=edge[0], target=edge[1])
milestone_net.append([edge[0], edge[1], np.max([len(p) for p in paths])-1])
if edge[0]==init_node:
dist = 1
else:
paths_0 = nx.all_simple_paths(subgraph, source=init_node, target=edge[0])
paths_1 = nx.all_simple_paths(subgraph, source=init_node, target=edge[1])
dist = np.max([len(p) for p in paths_1]) - np.max([len(p) for p in paths_0])
milestone_net.append([edge[0], edge[1], dist])
else:
# Dijkstra's Algorithm to find the shortest path
unvisited = {node: {'parent':None,
Expand Down

0 comments on commit af881b0

Please sign in to comment.