dagrejs / dagre-d3

A D3-based renderer for Dagre
MIT License
2.86k stars 592 forks source link

Can not reuse graph from run() #32

Closed coli closed 10 years ago

coli commented 10 years ago

Open console and load http://jsfiddle.net/aHC42/2/

I'm trying to modify the layout graph that is returned from renderer.run(), and it fails with an exception at

Uncaught TypeError: undefined is not a function dagre-d3.js:2313
checkSupportedPrefRank dagre-d3.js:2313
(anonymous function) dagre-d3.js:2282
dfs dagre-d3.js:2273
exports.apply dagre-d3.js:2309
(anonymous function) dagre-d3.js:3019
run dagre-d3.js:2095
(anonymous function) dagre-d3.js:3019
run dagre-d3.js:1057
(anonymous function) dagre-d3.js:3019
runLayout dagre-d3.js:227
Renderer.run dagre-d3.js:178
draw (index):110

If I use the original graph then it works.

coli commented 10 years ago

BTW: I'm trying to implement toggling of nodes, similar to a tree view like http://fiddle.jshell.net/86M45/3/show/ , and I'm realizing that the directed graph API make this quite hard to do...

cpettitt commented 10 years ago

That is more or less expected. The output graph does not include the data from the input graph. It is fine to update the input graph and rerun the algorithm though.

coli commented 10 years ago

K, that's what I'm doing now.