3

I have 4k+ nodes with edges and i am trying to visualize the network using networkX. Here is the output and my simple code:

import networkx as nx
import matplotlib.pyplot as plt

class NetworkVisualization(object):

    def __init__(self,gml_file):
        self.gml_file = gml_file

    def gml_file_importer(self):
        self.G = nx.read_gml(self.gml_file)
        print "GML file %s was successfully imported" %self.gml_file

    def draw_network(self):
        nx.draw(self.G)
        pos = nx.spring_layout(self.G)
        nx.draw_networkx_labels(self.G,pos, font_size=8,font_family='sans-serif')
        plt.savefig("graph")  

def main():
    gml_file = 'graph_gml_file.gml'
    nv = NetworkVisualization(gml_file)
    nv.gml_file_importer()
    nv.draw_network()

if __name__ == "__main__":
    main()  

Figure

I am trying to find a way to visualize better the network! Any idea? Thank you in advance!

zuperakos
  • 355
  • 4
  • 18
  • Maybe this helps http://stackoverflow.com/questions/21978487/improving-python-networkx-graph-layout – ρss Jan 15 '15 at 14:56
  • Does the network have any particular structure that you might be able to take advantage of? – Joel Jan 15 '15 at 15:26
  • Some obvious things - unless you need the node labels, get rid of them. Shrink the nodes. But that's not really going to help because of the size of the network. Depending on what the structure looks like, you may be able to get somewhere by grouping related nodes close together. But that's going to be network-dependent. – Joel Jan 15 '15 at 15:28

0 Answers0