Bug Report
Description
DataJoint's Diagram feature does not work properly with recent versions of pydot and networkx packages because node_ids containing . are not encapsulated in double quotes " an required by DOT language specification for graphviz. This is seen when examining the dot string representation generated by networkx.drawing.nx_pydot.to_pydot
# Generate the diagram
diagram = dj.Diagram(ephys_element)
pydot_graph = diagram.make_dot()
dot_str = pydot_graph.to_string()
print(dot_str)
Trunctaed dot_str below. This fails when run through dot -Tsvg but passes if wrapped in ".
strict digraph {
ephys_element.AcquisitionSoftware;
}
Testing of networkx
Here is a working example using networkx directly:
import networkx as nx
from networkx.drawing.nx_pydot import to_pydot
# Create a new graph
G = nx.DiGraph()
# Add two nodes
node_1 = '"a.a"'
G.add_node(node_1)
# Convert the graph to a pydot object
pydot_graph = to_pydot(G)
and excluding the double quotes results in the same error as calling Diagram()
import networkx as nx
from networkx.drawing.nx_pydot import to_pydot
# Create a new graph
G = nx.DiGraph()
# Add two nodes
node_1 = 'a.a'
G.add_node(node_1)
# Convert the graph to a pydot object
pydot_graph = to_pydot(G)
"dot" with args ['-Tsvg', '/var/folders/98/ncnp2y1n00qc_4y4ndc9mw240000gp/T/tmpj1xh62up'] returned code: 1
stdout, stderr:
b''
b"Error: [/var/folders/98/ncnp2y1n00qc_4y4ndc9mw240000gp/T/tmpj1xh62up](https://file+.vscode-resource.vscode-cdn.net/var/folders/98/ncnp2y1n00qc_4y4ndc9mw240000gp/T/tmpj1xh62up): syntax error in line 2 near '.'\n"
Reproducibility
Include:
- OS ( MACOS)
- Python Version: 3.10-3.12
- MySQL Version: N/A
- MySQL Deployment Strategy (local-native | local-docker | remote): N/A
- DataJoint Version: 0.14.2
- Minimum number of steps to reliably reproduce the issue: 1
- Complete error stack as a result of evaluating the above steps
Bug Report
Description
DataJoint's Diagram feature does not work properly with recent versions of
pydotandnetworkxpackages because node_ids containing.are not encapsulated in double quotes"an required by DOT language specification for graphviz. This is seen when examining the dot string representation generated bynetworkx.drawing.nx_pydot.to_pydotTrunctaed
dot_strbelow. This fails when run throughdot -Tsvgbut passes if wrapped in".Testing of networkx
Here is a working example using
networkxdirectly:and excluding the double quotes results in the same error as calling
Diagram()Reproducibility
Include: