简体   繁体   中英

How to draw a graph with NetworkX based on adjacency of nodes

I'm seeing in many research papers graphical representations of directed graphs where nodes seem to be placed depending on their adjacency rather than on features for the x and y axis. An example of it, from Conover, Michael D., et al. "Political polarization on twitter." Fifth international AAAI conference on weblogs and social media. 2011. Conover, Michael D., et al. "Political polarization on twitter." Fifth international AAAI conference on weblogs and social media. 2011.

在此处输入图片说明

How can I obtain such a representation from a pre constructed NetworkX DiGraph

NetworkX has built in functions to draw graphs (see here ). You can basically call them and pass the DiGraph you constructed. Copying from one of their own examples:

G = nx.dodecahedral_graph()
nx.draw(G)
nx.draw(G, pos=nx.spring_layout(G))

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