private static <V extends VisualVertex, E extends VisualEdge<V>> Collection<V> 
		getVerticesOfSelectedOrHoveredEdges(Graph<V, E> graph, boolean useHover) {
	//@formatter:on

		List<V> result = new LinkedList<>();
		Collection<E> edges = graph.getEdges();
		LinkedList<E> filteredEdges = new LinkedList<>();
		if (useHover) {
			for (E edge : edges) {
				if (edge.isInHoveredVertexPath()) {
					filteredEdges.add(edge);
				}
			}
		}
		else {
			for (E edge : edges) {
				if (edge.isSelected()) {
					filteredEdges.add(edge);
				}
			}
		}

		Collection<V> vertices = GraphAlgorithms.toVertices(filteredEdges);
		result.addAll(vertices);
		return result;
	}
Returns a collection of vertices that are incident to selected edges.

@param graph the graph from which to retrieve vertices
@return a collection of vertices that are incident to selected edges.
Ghidra/Framework/Graph/src/main/java/ghidra/graph/viewer/GraphViewerUtils.java