# Integrating graphviz with unity

**URL:** <https://forum.graphviz.org/t/integrating-graphviz-with-unity/1103>\
**Category:** Help\
**Created:** [April 1, 2022, 8:58pm UTC](https://forum.graphviz.org/t/integrating-graphviz-with-unity/1103 "2022-04-01T20:58:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pengibaby](https://avatars.discourse-cdn.com/v4/letter/p/779978/32.png) [@Pengibaby](https://forum.graphviz.org/u/Pengibaby)\
**Post date:** [April 1, 2022, 8:58pm UTC](https://forum.graphviz.org/t/integrating-graphviz-with-unity/1103/1 "2022-04-01T20:58:03Z")

</div>

Hello!

I am new to graphviz, which got recommended to me because I wanted to visualize graphs that I created in Unity. So currently, I have no idea how to use it.

I have some C# Scripts that allow users to type in to a textbox in Unity the all the nodes, edges and weights, then convert that in to a graph, represented using an adjacency list when the user clicks the “done typing” button. However, I wanted to visualize the graph, not just storing it as some data structure in computer memory.

So is there a way of integrating graphviz with unity, so that after the adjacency list is created (using C#), I can somehow send that to graphviz and get a image of that graph, which will then be displayed in Unity UI?

---

<div class="post-metadata">

**Author:** ![steveroush](https://avatars.discourse-cdn.com/v4/letter/s/a9adbd/32.png) [@steveroush](https://forum.graphviz.org/u/steveroush)\
**Post date:** [April 2, 2022, 12:35am UTC](https://forum.graphviz.org/t/integrating-graphviz-with-unity/1103/2 "2022-04-02T00:35:17Z")

</div>

I am ignorant. What is Unity? And what OS?  
At a very high level:  
If there is no api available for your language:

- create a text file. e.g.

```auto
digraph mine {
  { node[shape=point width=.01] p1 p2}
  a -> p1 [headclip=false arrowhead=open] 
  p1 -> b [dir=none tailclip=false]
  b -> p2 [headclip=false]
  p2 -> c [dir=none tailclip=false]
}

```

- some kind of system call: `dot -Tsvg mynewfile.gv > mynewfile.svg`
- display the output file

If there is an api available (python, c, c++, java, …), you can combine all three steps (no real text file needed)

---

<div class="post-metadata">

**Author:** ![Pengibaby](https://avatars.discourse-cdn.com/v4/letter/p/779978/32.png) [@Pengibaby](https://forum.graphviz.org/u/Pengibaby)\
**Post date:** [April 2, 2022, 11:44am UTC](https://forum.graphviz.org/t/integrating-graphviz-with-unity/1103/3 "2022-04-02T11:44:39Z")

</div>

Thank you for your reply!

I am using Windows 10 OS; Unity is a game engine I am using currently for making a game, it uses C# scripts to run the game. So I’m wondering if I can visualize graphs using just C# code and possibly graphviz integration.

The text file makes sense to me, but I’m not sure how to do the system call.

---

<div class="post-metadata">

**Author:** ![smattr](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/smattr/32/85_2.png) [@smattr](https://forum.graphviz.org/u/smattr)\
**Post date:** [April 2, 2022, 6:13pm UTC](https://forum.graphviz.org/t/integrating-graphviz-with-unity/1103/4 "2022-04-02T18:13:16Z")

</div>

Graphviz’ Autotools build system produces C# bindings, for which you can see example usage in [tclpkg/gv/test.cs · f9293d0d3d625dc31816f9e864045542a590f14e · graphviz / graphviz · GitLab](https://gitlab.com/graphviz/graphviz/-/blob/f9293d0d3d625dc31816f9e864045542a590f14e/tclpkg/gv/test.cs). Though I don’t know what state these are in or whether anyone is using them.
