There is an undirected graph consisting of n nodes indexed from n vals of length n, where vals[i] represents the value of node i. You are also given a edges, where edges[i] = [a_i, b_i] represents an undirected edge between node a_i and node b_i.
Additionally, you are given an integer k.
A star graph is a subgraph containing a center node and at most k of its neighbors. The star sum is the sum of the values of the center node and all included neighbor nodes.
Return the maximum star sum among all possible star graphs in the given graph.
Constraints:
n vals.length
n
vals[i]
edges.length n n
edges[i].length
a_i, b_i n
a_i b_i
k n
There is an undirected graph consisting of n nodes indexed from n vals of length n, where vals[i] represents the value of node i. You are also given a edges, where edges[i] = [a_i, b_i] represents an undirected edge between node a_i and node b_i.
Additionally, you are given an integer k.
A star graph is a subgraph containing a center node and at most k of its neighbors. The star sum is the sum of the values of the center node and all included neighbor nodes.
Return the maximum star sum among all possible star graphs in the given graph.
Constraints:
n vals.length
n
vals[i]
edges.length n n
edges[i].length
a_i, b_i n
a_i b_i
k n