You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue
When using Nodes that contain classes, the dotexporter seems to export a cached version of the graph instead of properly evaluating all classes toString. This causes wrong outputs.
Steps to reproduce (small coding example)
importorg.jgrapht.graph.DefaultDirectedGraphimportorg.jgrapht.graph.DefaultEdgeimportorg.jgrapht.nio.dot.DOTExporterimportjava.io.FileclassNode(valwrapper:StringWrap)
classStringWrap(varvalue:String)
funmain() {
val graph =DefaultDirectedGraph<Node, DefaultEdge>(DefaultEdge::class.java)
val node1 =Node(StringWrap("old"))
graph.addVertex(node1)
val exporter =DOTExporter<Node, DefaultEdge> { """"${it.wrapper.value}"""" }
exporter.exportGraph(graph, File("old.dot").bufferedWriter()) // <- commenting out this line will eliviate the bug
node1.wrapper.value ="new"
exporter.exportGraph(graph, File("new.dot").bufferedWriter())
}
Than new.dot contains the old data
strictdigraphG {
"old";
}
Expected behaviour
new.dot containing the updated data
strictdigraphG {
"new";
}
Other information
The problem is actually caused by the first export call. This somehow caches information inside the exporter. When commenting out the first export call the result is correct.
Also it is importaint that the data is contained inside a class. It seems that it checks if the class reference has changed. changing the updating code to node1.wrapper = new StringWrap("new") will work!.
The text was updated successfully, but these errors were encountered:
Issue
When using Nodes that contain classes, the dotexporter seems to export a cached version of the graph instead of properly evaluating all classes toString. This causes wrong outputs.
Steps to reproduce (small coding example)
Than
new.dot
contains the old dataExpected behaviour
new.dot
containing the updated dataOther information
The problem is actually caused by the first export call. This somehow caches information inside the exporter. When commenting out the first export call the result is correct.
Also it is importaint that the data is contained inside a class. It seems that it checks if the class reference has changed. changing the updating code to
node1.wrapper = new StringWrap("new")
will work!.The text was updated successfully, but these errors were encountered: