How do I get position.bin from ngraph.native?

Viewed 41

I'm using ngraph family libraries to build some graphs in browser.

I've tried to run layout using ngraph.native but all that I get is ~10k .bin files without position.bin.

Am I missing something? What should I do after I get all those .bin files?

Here's what I tried:

  • creating graph in node.js
  • converting graph to binary using ngraph.tobinary
  • exporting links.bin to ngraph.native
  • executing command layout++ links.bin

Thx!

1 Answers

Ok. Guess I figured out how to get positions.bin

I took a look at ngraph.offline.layout source and found that positions.bin is created after all iterations are completed.

So. Here are my changes that helped to get positions.bin (all changes made in file main.cpp (ngraph.native/demo/gcc/main.cpp):

  • in void save() change first param type from int to string
  • in int main() at the bottom inside last for-loop change save(i, graphLayout.getBodies()); to save(to_string(i), graphLayout.getBodies());
  • in int main() at the bottom after last for-loop add save("positions", graphLayout.getBodies());

That's it.

Related