William A.
William A.

Reputation: 455

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.

enter image description here

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

Upvotes: 0

Views: 167

Answers (1)

matheubv
matheubv

Reputation: 166

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))

Upvotes: 1

Related Questions