# (Directed acyclic) graphs with non-integer data type

**URL:** <https://discourse.julialang.org/t/directed-acyclic-graphs-with-non-integer-data-type/87744>\
**Category:** Graphs\
**Tags:** indexing, graphs\
**Created:** [September 24, 2022, 3:03pm UTC](https://discourse.julialang.org/t/directed-acyclic-graphs-with-non-integer-data-type/87744 "2022-09-24T15:03:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![DanielVandH](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/danielvandh/32/31134_2.png) [@DanielVandH](https://discourse.julialang.org/u/DanielVandH)\
**Post date:** [September 24, 2022, 3:03pm UTC](https://discourse.julialang.org/t/directed-acyclic-graphs-with-non-integer-data-type/87744/1 "2022-09-24T15:03:10Z")

</div>

Is there a Julia package that I can use for defining a directed acyclic graph with non-integer vertices? I looked around at Graphs.jl, but it seems that I’m restricted to integer indices there. The main indices I do want would be `NTuple{3, Int64}`.

---

<div class="post-metadata">

**Author:** ![CameronBieganek](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cameronbieganek/32/6915_2.png) [@CameronBieganek](https://discourse.julialang.org/u/CameronBieganek)\
**Post date:** [September 24, 2022, 8:43pm UTC](https://discourse.julialang.org/t/directed-acyclic-graphs-with-non-integer-data-type/87744/2 "2022-09-24T20:43:10Z")

</div>

SimpleGraphs.jl allows non-integer vertices:

> **[GitHub - scheinerman/SimpleGraphs.jl: Convenient way to handle simple graphs...](https://github.com/scheinerman/SimpleGraphs.jl)**
>
> Convenient way to handle simple graphs and digraphs - GitHub - scheinerman/SimpleGraphs.jl: Convenient way to handle simple graphs and digraphs

---

<div class="post-metadata">

**Author:** ![DanielVandH](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/danielvandh/32/31134_2.png) [@DanielVandH](https://discourse.julialang.org/u/DanielVandH)\
**Post date:** [September 24, 2022, 8:59pm UTC](https://discourse.julialang.org/t/directed-acyclic-graphs-with-non-integer-data-type/87744/3 "2022-09-24T20:59:39Z")

</div>

Great! That indeed seems to work:

```julia
dag = DirectedGraph{NTuple{3, Int64}}()
forbid_loops!(dag)
[add!(dag, v) for v in [(1, 2, 3), (3, 2, 1)]]
add!(dag, (1, 2, 3), (3, 2, 1))

```

Thank you.

---

<div class="post-metadata">

**Author:** ![gdalle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdalle/32/27854_2.png) [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Post date:** [September 24, 2022, 9:58pm UTC](https://discourse.julialang.org/t/directed-acyclic-graphs-with-non-integer-data-type/87744/4 "2022-09-24T21:58:09Z")

</div>

There is also an ongoing discussion about the best way to incorporate vertex- and edge-level metadata (like tuples) into the Graphs.jl ecosystem. Some packages already exist, like MetaGraphsNext.jl, but they’re still kind of experimental, and more thought is needed on their design
