Search code examples
network-programmingdiagramnetworkxtopology

how can i choose image/picture for my nodes in gexf or networkx


my project's aim is to generate a network diagram, I've made a program that creates objects as swicth and nodes in python then it generates a gexf file and my question is :

Can everybody tell me if he knows a way that allow us to choose a node image by using gexf, networkx or other tools.

Thank you so much


Solution

  • NetworkX supports adding any form of data as attributes for a node such as an image:

    G=nx.Graph() 
    G.add_edge(0,1, image=my_img)
    

    Essentially everything is stored as a dictionary underneath.