read_dot error - add an extra vertex

13 views
Skip to first unread message

André Guedes

unread,
Sep 23, 2024, 7:55:11 PMSep 23
to networkx-discuss

Hello,

I am using read_dot from pydot (v. 1.4.2-2) and networkx (v. 2.8.8-1ubuntu1), in Python3 (v. 3.12.3).

Sometimes read_dot add an extra vertex with label "\n". I noticed that this has some relation with the presence of a ";" at the end of the last line. For instance, consider the simple code below, in a file named t.

import sys import networkx as nx 
g = nx.Graph(nx.nx_pydot.read_dot(sys.stdin))
print(g,file=sys.stderr)
nx.nx_pydot.write_dot(g,sys.stdout)`


Also, consider an input file, name test1.dot.

graph {
1 -- 2;
}


The output of the command `$ t < test1.dot' gives the output below.

Graph named 'G' with 3 nodes and 1 edges
strict graph "G" {
"\n";
1;
2;
1 -- 2;
}


Note that there is an extra vertex.

If we remove the ";" from the input file, the output is correct.

Graph named 'G' with 2 nodes and 1 edges
strict graph "G" {
1;
2;
1 -- 2;
}


Have someone noticed that error before? Is that a real bug or I am using it in the wrong way?


Thanks,

André Guedes

PS. I posted that on stackoverflow:

https://stackoverflow.com/questions/79010300/networkx-read-dot-error-add-an-extra-vertex



Andre Guedes

unread,
Sep 23, 2024, 8:54:57 PMSep 23
to networkx...@googlegroups.com
I was informed that this bug was fixed in version 2.0.0 of pydot.
So you can forget about it.

Sorry to bother you.
André Guedes


--
You received this message because you are subscribed to the Google Groups "networkx-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to networkx-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/networkx-discuss/fc1116e2-9559-4e4f-a612-04066f122ed2n%40googlegroups.com.


--
Andre Guedes
Reply all
Reply to author
Forward
0 new messages