Hi. I am trying to write a code using igraph in Jupiter on AWS in order to get adjacent/ neighbours of more than one vertex. To start, I want to have two vertices’ neighbourhood and then find the shared neighbourhood of these two vertices and finally subtract the shared vertices. Right now, I can find neighbours of a vertex in one cell and then another vertex in another cell, and might find the intersection afterwards. But, I need to get it done in one cell. Could please let me know whether there is any code in this regard or I should define a function? In the latter case, any help would be appreciated.

You tagged this both as “Python” and as “Mathematica”. Which language are you using? Are you fine with either?

If by “cell” you mean a Jupyter cell, you can write as much or as little code in a cell as you like. It does not have to be one line per cell. Does this help?

If you need more help, please show (concrete code) what you’ve done so far, and explain what it is that is still missing from it.