Reusing APIs of existing libraries is a common practice during software development, but searching suitable APIs and their usages can be time-consuming [6] . In this paper, we study a new and more practical approach to help users find usages of APIs given only simple text phrases, when users have limited knowledge about an API library. We model API invocations as an API graph and aim to find an optimum connected subgraph that meets users' search needs. The problem is challenging since the search space in an API graph is very huge. We start with a greedy subgraph search algorithm which returns a connected subgraph containing nodes with high textual similarity to the query phrases. Two refinement techniques are proposed to improve the quality of the returned subgraph. Furthermore, as the greedy subgraph search algorithm relies on online query of shortest path between two graph nodes, we propose a spaceefficient compressed shortest path indexing scheme that can efficiently recover the exact shortest path. We conduct extensive experiments to show that the proposed subgraph search approach for API recommendation is very effective in that it boosts the average F1-measure of the state-of-theart approach, Portfolio [15], on two groups of real-life queries by 64% and 36% respectively.
Chan et al. REF proposed a practical approach to help users find usages of APIs given only simple text phrases, starting with a greedy subgraph search algorithm which returned a connected subgraph containing nodes with high semantic similarity to the query phrases.
Searching connected API subgraph via text phrases
SIGSOFT FSE
Computer Science