I am having a problem with networkX library in python. I build a graph that initialises some nodes, edges with attributes. I also developed a method that will dynamic add a specific attribute with a specific value to a target node. For example:
def add_tag(self,G,fnode,attr,value):for node in G:if node == fnode:attrs = {fnode: {attr: value}}nx.set_node_attributes(G,attrs)
Hence if we print the attributes of the target node will be updated
print(Graph.node['h1'])
{'color': u'green'}
self.add_tag(Graph,'h1','price',40)print(Graph.node['h1'])
{'color': u'green', 'price': 40}
My Question is How can I do the same thing for removing an existing attribute from a target node?? I can't find any method for removing/deleting attributes. I found just .update method and does not helps.
Thank you