magjac / d3-graphviz

Graphviz DOT rendering and animated transitions using D3
BSD 3-Clause "New" or "Revised" License
1.68k stars 103 forks source link

Error while rendering a graph with more than 270 edges #238

Closed vinaycheguri0245 closed 2 years ago

vinaycheguri0245 commented 2 years ago

I'm facing below error when I increase the number of edges in the graph after a certain limit. Can someone please help me in resolving this? Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value 16777216, (2) compile with -s ALLOW_MEMORY_GROWTH=1 which allows increasing the size at runtime but prevents some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or (4) if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0

Here is the code snippet d3.select("#app").graphviz().renderDot(data); console.log(d3)

Here are the dependencies and their versions d3: 5.9.1 d3-graphviz: 2.6.1 fs: 0.0.1-security

magjac commented 2 years ago

In version 2.6.1 that you are using, you can increase the available memory with the method .totalMemory(<power_of_two>). In later versions this is not necessary, so another option is to upgrade.

vinaycheguri0245 commented 2 years ago

I've upgraded d3 version to 7.6.0 and d3-graphviz version to 4.1.1 and facing below error. Can you please suggest the compatible d3 version for d3-graphviz?

index.js:6 Uncaught TypeError: d3.select(...).graphviz is not a function at parcelRequire.src/index.js.d3 (index.js:6:1) at newRequire (util.js:27:30) at util.js:55:11 at util.js:90:5

magjac commented 2 years ago

@vinaycheguri0245: Version 4.1.1 is compatible with D3 version 6.x. I haven't tested with 7.x. It's however possible that you need to use the exact same version as in the package.json:

$ grep '"d3":' package.json 
    "d3": "^6.6.1",

I think the important thing here is to have the same version of d3-selection:

$ grep '"d3-selection": "\^' package-lock.json 
        "d3-selection": "^2.0.0"
vinaycheguri0245 commented 2 years ago

image @magjac , I've tried using versions 6.6.0 for d3 and 4.1.1 for d3-graphviz but facing above error. I've also tried multiple other d3 versions but still issue remains. In package-lock.json, version is seen as 2.0.0

FYI, the code snippet being used is d3.select("#app").graphviz().renderDot(variant1); image

magjac commented 2 years ago

@vinaycheguri0245 : That's another error than the one you reported. This one is probably caused by the wrong version of @hpcc-js/wasm. See https://github.com/magjac/d3-graphviz/issues/239#issuecomment-1229546276.

vinaycheguri0245 commented 2 years ago

@magjac here are the dependencies present in my project. There isn't any dependency like @hpcc-js/wasm. I've also tried adding @hpcc-js/wasm dependency of version 1.15.4 but still the issue remains "dependencies": { "d3": "6.6.0", "d3-graphviz": "4.1.1", "fs": "0.0.1-security" }, "devDependencies": { "@babel/core": "7.2.0", "parcel-bundler": "^1.6.1" }

magjac commented 2 years ago

@vinaycheguri0245: It's a dependency of d3-graphviz. See https://github.com/magjac/d3-graphviz#defining-the-hpcc-jswasm-script-tag.

If you need additional help, I suggest you use Stack Overflow instead. This issue was about something completely different.