Is it possible to query the Google Knowledge graph API to get an edge(or relation) between two nodes in it? Or alternatively, perhaps to find the nearest n nodes to a specified node?
The Knowledge Graph API does not support relations between two entities (notice there is only one method entities.search
available here).
The closest you can get to comparing the two entities is by using Google Trends, e.g. for /m/0dl567
vs /m/0478__m
(notice the Knowledge Graph IDs in the URL). As of August 2018, Google Trends does not offer an official API to do this programmatically.
To see the nearest nodes to a given node, you browse through the "Related topics" section in Google Trends, e.g. here. The items in that list are URLs with IDs that you are looking for.