简体   繁体   中英

How can I connect two portion of my graph? in python

Hi all I have a graph which is split in two portion, like I am showing in the photo, I would like to connect the two portion by adding a red edges like I am showing in the photo. Someone know a networkx function to do that? 在此处输入图片说明

If you do not have to calculate anything else (meaning the nodes to be connected are fixed - in the example 4 an 6) a simple

G.add_edge(4, 6)

will do. ( documentation )

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