# Libraries for Computational Graphs

**URL:** <https://discourse.julialang.org/t/libraries-for-computational-graphs/62293>\
**Category:** General Usage\
**Created:** [June 2, 2021, 6:47pm UTC](https://discourse.julialang.org/t/libraries-for-computational-graphs/62293 "2021-06-02T18:47:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Satvik](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/satvik/32/20486_2.png) [@Satvik](https://discourse.julialang.org/u/Satvik)\
**Post date:** [June 2, 2021, 6:47pm UTC](https://discourse.julialang.org/t/libraries-for-computational-graphs/62293/1 "2021-06-02T18:47:29Z")

</div>

Hi,

I have functions that look something like this:

```julia
C(x) = A(x) + B(x)
B(x) = 2*A(x)
A(x) = exp(x)

```

where I’d like to calculate `C(x)` while only evaluating `A(x)` once. The actual situation is more complex, e.g. a naive implementation might calculate `A(x)` hundreds of times.

What libraries are good for this? Some options I’ve seen are `Symbolics / ModelingToolKit`, `NaiveNASLib`, or rolling my own (which I’d prefer to avoid) using `LightGraphs`.

---

<div class="post-metadata">

**Author:** ![Jeff\_Emanuel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jeff_emanuel/32/15440_2.png) [@Jeff\_Emanuel](https://discourse.julialang.org/u/Jeff_Emanuel)\
**Post date:** [June 2, 2021, 6:51pm UTC](https://discourse.julialang.org/t/libraries-for-computational-graphs/62293/2 "2021-06-02T18:51:56Z")

</div>

Perhaps [https://github.com/JuliaCollections/Memoize.jl](https://github.com/JuliaCollections/Memoize.jl)

---

<div class="post-metadata">

**Author:** ![DrChainsaw](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/drchainsaw/32/8497_2.png) [@DrChainsaw](https://discourse.julialang.org/u/DrChainsaw)\
**Post date:** [June 2, 2021, 7:16pm UTC](https://discourse.julialang.org/t/libraries-for-computational-graphs/62293/3 "2021-06-02T19:16:38Z")

</div>

Also [GitHub - JuliaParallel/Dagger.jl: A framework for out-of-core and parallel execution](https://github.com/JuliaParallel/Dagger.jl)

Edit: LightGraphs does not offer much help for the computation itself. If used just to keep the graph, one thing to look out for iirc is that it does not seem to order edges in to a vertex so non-commutative operations might fail unexpectedly.
