Given an undirected graph $G=(V,E)$ where $V=\{v_1,v_2,...,v_n\}$ denotes the vertices and $E=\{e_1,e_2,...,e_m\}$ denotes edges. Moreover, there exists a nonnegative weight associated with each edge.
We have some arbitrary set of terminal nodes denoted by $T$, in which $T \subset V$. For the sake of illustration, let $T=\{v_2,v_4,v_5,v_6\}$. Considering the set $T$, we need to find the $p$ vertices ($p \ll |V|$) from the set $V$ that has the minimum distance from the set $T$.
In other words, let's assume $p=2$. First, we seek to find a vertex from set $V$ that has a minimum distance with respect to edges weight to vertices in set $T$. Second, what is the second minimum vertex from $V$?
• Are there any well-known problems in graph theory related to what is described?
• What is the most efficient algorithm to solve this problem?
Note: In more general perspective, is there any efficient algorithm to calculate $K-$Vertex of K-least distance to all other vertices in a sample graph?