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.