简体   繁体   中英

Networkx - Get destiny node on a directed graph

I'm working with networkx. At certain time, I want to get the destiny node of another one. I will explain it with a graph:

在此输入图像描述

For example, given the node 'foto' or the node 'spain', I want to receive the node 'madrid'. Is there a direct method to achieve this or it would be a bit harder?

I just found what I wanted.

There is a method on Directed Graphs called successors that returns just what I was asking. So, in order to achieve that I have only to call it like this:

successors = graph.successors(node)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM