Abstract: This study proposes the version of k nearest neighbor where words are encoded into graphs, instead of numerical vectors as the approach to the task of keyword extraction. The keyword extraction is mapped into a binary classification task within a domain and the task should be distinguished from the topic based word categorization. In this research, words are encoded into string vectors each of which is represented into a list of edges, the k nearest neighbor algorithm is modified by adopting the proposed similarity metric and it is applied to the keyword extraction which is mapped into a binary classification. It is validated empirically that the proposed k nearest neighbor version is better than the traditional version in extracting keywords from a text which is tagged with its own domain. In future, we will connect the task with the text categorization in order to process texts which are untagged with their domains.