Avatar

Organizations

1 results for 最短路
  • You are given an integer n denoting the number of nodes of a weighted directed graph. The nodes are numbered from 0 to n - 1.

    You are also given a 2D integer array edges where \(edges[i] = [from_i, to_i, weight_i]\) denotes that there exists a directed edge from \(from_i\) to \(to_i\) with weight \(weight_i\).

    Lastly, you are given three distinct integers src1, src2, and dest denoting three distinct nodes of the graph.

    Return the minimum weight of a subgraph of the graph such that it is possible to reach dest from both src1 and src2 via a set of edges of this subgraph. In case such a subgraph does not exist, return -1.

    A subgraph is a graph whose vertices and edges are subsets of the original graph. The weight of a subgraph is the sum of weights of its constituent edges.

    leetcode 困难 枚举 最短路 Created Sun, 13 Mar 2022 20:28:53 +0800