Alejandro Weinstein
unread,May 11, 2011, 7:04:58 PM5/11/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to networkx-discuss
Hi:
I don't know if this is an expected behavior or if it is a bug. In a
weighted digraph, if I set the weight of an edge equal to 0, and then
save the graph in GEXF format, the weight of that edge in the GEXF
file is missing. The problem is that when I open the file in Gephi,
that edge appears with a weight equal to 1.
The following code illustrate the problem:
import networkx as nx
G = nx.DiGraph()
G.add_node('A')
G.add_node('B')
G.add_node('C')
G.add_edge('A', 'B', weight=2)
G.add_edge('B', 'C', weight=1)
G.add_edge('C', 'A', weight=0)
nx.write_gexf(G, 'graph.gexf')
These are the edges that appear in graph.gexf:
<edge id="0" source="A" target="B" weight="2" />
<edge id="1" source="C" target="A" />
<edge id="2" source="B" target="C" weight="1" />
I am using Networkx version 1.4 and Python 2.6.5
Alejandro.