# LightGraphs.jl Transition

**URL:** https://discourse.julialang.org/t/lightgraphs-jl-transition/69526
**Category:** Graphs
**Tags:** package, announcement, lightgraphs, graphs
**Created:** [October 10, 2021, 11:04pm UTC](https://discourse.julialang.org/t/lightgraphs-jl-transition/69526 "2021-10-10T23:04:43Z")
**Posts on this page:** 20
**Page:** 2

<div class="post-metadata">

### Author: ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)
#### Post date: [October 18, 2021, 9:04pm UTC](https://discourse.julialang.org/t/lightgraphs-jl-transition/69526/21 "2021-10-18T21:04:49Z")

</div>

Well, it’s simultaneously very breaking and not breaking much at all, depending upon your perspective. Since the LightGraphs history is preserved inside Graphs.jl, you can see that [pretty much all the code changes are for the module names and documentation and CI](https://github.com/JuliaGraphs/Graphs.jl/compare/57ec9bb6f0dba5aec512b38af09bb0a9b812003d..v1.4.0). Jumping from LightGraphs to Graphs shouldn’t be very difficult at all (but is technically a “breaking” upgrade since it requires some code changes to do so). Jumping from Graphs v0.10 to v1.4 would of course be a complete re-implementation.

---

<div class="post-metadata">

### Author: ![gustaphe](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gustaphe/32/18174_2.png) [@gustaphe](https://discourse.julialang.org/u/gustaphe)
#### Post date: [October 18, 2021, 9:17pm UTC](https://discourse.julialang.org/t/lightgraphs-jl-transition/69526/22 "2021-10-18T21:17:14Z")

</div>

I thought the number was chosen to be the next up from `Graphs`’ last number. But I see, `Graphs 1.4.0` is the feature release following `LightGraphs 1.3.5`, with the new feature of being named `Graphs` 😛

This is good, I’m just being facetious.

---

<div class="post-metadata">

### Author: ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)
#### Post date: [October 18, 2021, 9:24pm UTC](https://discourse.julialang.org/t/lightgraphs-jl-transition/69526/23 "2021-10-18T21:24:12Z")

</div>

> [@mbauman](#):
>
> Jumping from LightGraphs to Graphs shouldn’t be very difficult at all (but is technically a “breaking” upgrade since it requires some code changes to do so).

I have already transitioned one of my packages and I can confirm that the transition is way easy. All I needed to do to get it working with `Graphs` was to change the `Project.toml` dependency from `LightGraphs` to `Graphs` and switch `using LightGraphs` to `using Graphs`.

However, from a semantic versioning point of view this is more than technically breaking. Trying to use a graph from `LightGraphs` with functions from `Graphs` doesn’t work at all (\*) and my package was documented to take a `LightGraphs` graph as input. I worked around that with a horrible hack but I expect that a lot of packages really will break user code with the transition.

(\*) More specifically, this is what happens:

```julia
julia> import LightGraphs, Graphs

julia> graph = LightGraphs.path_digraph(5)
{5, 4} directed simple Int64 graph

julia> Graphs.outneighbors(graph, 1)
ERROR: method outneighbors not implemented.
Stacktrace:
 [1] _NI(m::String)
   @ Graphs ~/.julia/packages/Graphs/mjncd/src/interface.jl:16
 [2] outneighbors(x::LightGraphs.SimpleGraphs.SimpleDiGraph{Int64}, v::Int64)
   @ Graphs ~/.julia/packages/Graphs/mjncd/src/interface.jl:320
 [3] top-level scope
   @ REPL[3]:1

```

There is nothing strange or surprising about this but it _is_ breaking in a real sense.

---

<div class="post-metadata">

### Author: ![Cory\_Simon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cory_simon/32/3950_2.png) [@Cory\_Simon](https://discourse.julialang.org/u/Cory_Simon)
#### Post date: [October 19, 2021, 7:08pm UTC](https://discourse.julialang.org/t/lightgraphs-jl-transition/69526/25 "2021-10-19T19:08:11Z")

</div>

thank you so much for your efforts. my research group heavily depends/ed on `LightGraphs.jl`.

---

<div class="post-metadata">

### Author: ![cscherrer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cscherrer/32/7631_2.png) [@cscherrer](https://discourse.julialang.org/u/cscherrer)
#### Post date: [October 21, 2021, 4:28pm UTC](https://discourse.julialang.org/t/lightgraphs-jl-transition/69526/26 "2021-10-21T16:28:30Z")

</div>

Will code depending on the old Graphs.jl work with the new one? Soss depends on that rather than LightGraphs. At least at the time it was much easier to use for non-Int nodes, and my graphs are mostly relatively small. But if that’s being deprecated (is it?) I’ll need to find a transition path.

---

<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: [October 21, 2021, 4:46pm UTC](https://discourse.julialang.org/t/lightgraphs-jl-transition/69526/27 "2021-10-21T16:46:15Z")

</div>

I think the old Graphs.jl has been effectively abandoned for a long time. In fact, the old Graphs.jl was archived in the JuliaAttic github group. Actually, it’s still in the Attic, but now called OldGraphs.jl:

[https://github.com/JuliaAttic/OldGraphs.jl](https://github.com/JuliaAttic/OldGraphs.jl)

---

<div class="post-metadata">

### Author: ![cscherrer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cscherrer/32/7631_2.png) [@cscherrer](https://discourse.julialang.org/u/cscherrer)
#### Post date: [October 21, 2021, 4:54pm UTC](https://discourse.julialang.org/t/lightgraphs-jl-transition/69526/28 "2021-10-21T16:54:41Z")

</div>

Thanks @CameronBieganek. Docs on JuliaHub give me a 404, so two questions…

- Does the new Graphs.jl have a topological sort?
- Does the SimpleGraphs module have anything to do with the [SimpleGraphs package](https://github.com/scheinerman/SimpleGraphs.jl)? Oh wait, or maybe that was in the old Graphs. Sorry, this is confusing me.

---

<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: [October 21, 2021, 5:14pm UTC](https://discourse.julialang.org/t/lightgraphs-jl-transition/69526/29 "2021-10-21T17:14:12Z")

</div>

> [@cscherrer](#):
>
> Does the new Graphs.jl have a topological sort?

Yup:

[https://juliagraphs.org/Graphs.jl/dev/pathing/#Graphs.topological\_sort\_by\_dfs](https://juliagraphs.org/Graphs.jl/dev/pathing/#Graphs.topological_sort_by_dfs)

> [@cscherrer](#):
>
> Does the SimpleGraphs module have anything to do with the [SimpleGraphs package](https://github.com/scheinerman/SimpleGraphs.jl)?

Nope, the `SimpleGraphs` module is unrelated to `SimpleGraphs.jl`.

`SimpleGraph` and `SimpleDiGraph` are the two provided implementations of the `AbstractGraph` API from LightGraphs (now Graphs).

---

<div class="post-metadata">

### Author: ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)
#### Post date: [October 22, 2021, 12:24am UTC](https://discourse.julialang.org/t/lightgraphs-jl-transition/69526/30 "2021-10-22T00:24:42Z")

</div>

Yes, all old versions of Graphs are still there and work the same as before. The two repos have been merged and hah can think of Graphs 1.4 as a very breaking new release of the old Graphs that happens to have the same API as LightGraphs 1.3.5, aside from the package name.

---

<div class="post-metadata">

### Author: ![cscherrer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cscherrer/32/7631_2.png) [@cscherrer](https://discourse.julialang.org/u/cscherrer)
#### Post date: [October 22, 2021, 12:31am UTC](https://discourse.julialang.org/t/lightgraphs-jl-transition/69526/31 "2021-10-22T00:31:25Z")

</div>

Nice! Guess I need to swap out UUID and version numbers, and maybe it’s all good to go

---

<div class="post-metadata">

### Author: ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)
#### Post date: [October 22, 2021, 12:28pm UTC](https://discourse.julialang.org/t/lightgraphs-jl-transition/69526/32 "2021-10-22T12:28:38Z")

</div>

You shouldn’t have to do anything if you’re using an older version of Graphs. You may have to add a compat entry to make sure it doesn’t get upgraded to 1.4 which has the new LightGraphs API.

---

<div class="post-metadata">

### Author: ![Steven\_Sagaert](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/steven_sagaert/32/29578_2.png) [@Steven\_Sagaert](https://discourse.julialang.org/u/Steven_Sagaert)
#### Post date: [October 22, 2021, 12:37pm UTC](https://discourse.julialang.org/t/lightgraphs-jl-transition/69526/33 "2021-10-22T12:37:34Z")

</div>

I prefer the name Graphs to LightGraphs anyway. Short & sweet 🙂

---

<div class="post-metadata">

### Author: ![cscherrer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cscherrer/32/7631_2.png) [@cscherrer](https://discourse.julialang.org/u/cscherrer)
#### Post date: [October 22, 2021, 2:24pm UTC](https://discourse.julialang.org/t/lightgraphs-jl-transition/69526/34 "2021-10-22T14:24:41Z")

</div>

Looks like I was sill confused. I had first thought LightGraphs was just renamed Graphs, so the UUID would be that of LightGraphs.

> [@StefanKarpinski](#):
>
> The two repos have been merged and hah can think of Graphs 1.4 as a very breaking new release of the old Graphs

I had missed the “very breaking” part of this. Is there any documentation for migration?

> [@StefanKarpinski](#):
>
> You shouldn’t have to do anything if you’re using an older version of Graphs. You may have to add a compat entry to make sure it doesn’t get upgraded to 1.4 which has the new LightGraphs API.

I think that would be true if the UUIDs hadn’t been swapped around. But Soss is meant for people to build things on top of, and the UUID setup now means no one will be able to use the new Graph library with Soss unless I update everything.

---

<div class="post-metadata">

### Author: ![ericphanson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ericphanson/32/215186_2.png) [@ericphanson](https://discourse.julialang.org/u/ericphanson)
#### Post date: [October 22, 2021, 2:47pm UTC](https://discourse.julialang.org/t/lightgraphs-jl-transition/69526/35 "2021-10-22T14:47:12Z")

</div>

> [@cscherrer](#):
>
> I think that would be true if the UUIDs hadn’t been swapped around. But Soss is meant for people to build things on top of, and the UUID setup now means no one will be able to use the new Graph library with Soss unless I update everything.

If you look, the UUIDs have not been swapped around:

1. [https://github.com/JuliaAttic/OldGraphs.jl/blob/39a9c6efacc190ac79db47dd4dd951657058d2c0/Project.toml#L2](https://github.com/JuliaAttic/OldGraphs.jl/blob/39a9c6efacc190ac79db47dd4dd951657058d2c0/Project.toml#L2)
2. [https://github.com/JuliaGraphs/Graphs.jl/blob/6ab2160c6945930b4194e7b16a8f8c10184ede8e/Project.toml#L2](https://github.com/JuliaGraphs/Graphs.jl/blob/6ab2160c6945930b4194e7b16a8f8c10184ede8e/Project.toml#L2)

So if you are using compat, there should be no breakage to continue using the older versions of Graphs.jl (i.e. “OldGraphs”). If you want to update to v1, then everything is different because it is the LightGraphs API.

---

<div class="post-metadata">

### Author: ![cscherrer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cscherrer/32/7631_2.png) [@cscherrer](https://discourse.julialang.org/u/cscherrer)
#### Post date: [October 22, 2021, 3:03pm UTC](https://discourse.julialang.org/t/lightgraphs-jl-transition/69526/36 "2021-10-22T15:03:55Z")

</div>

That’s even more strange. Removing the version bound and calling `]up` updated my Graphs dependency to 1.4, still on

```julia
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"

```

The only explanation I can think of it that Pkg is ignoring UUIDs. But it must be something else, right? I mean, that’s the whole point of UUIDs.

> [@ericphanson](#):
>
> So if you are using compat, there should be no breakage to continue using the older versions of Graphs.jl (i.e. “OldGraphs”). If you want to update to v1, then everything is different because it is the LightGraphs API.

I don’t see what that has to do with compat. If the UUID hasn’t changed, shouldn’t I be able to use the latest Graphs with the OldGraphs UUID, and users can separately use (new) Graphs? How is compat relevant to any of this?

---

<div class="post-metadata">

### Author: ![ericphanson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ericphanson/32/215186_2.png) [@ericphanson](https://discourse.julialang.org/u/ericphanson)
#### Post date: [October 22, 2021, 3:17pm UTC](https://discourse.julialang.org/t/lightgraphs-jl-transition/69526/37 "2021-10-22T15:17:17Z")

</div>

I’m not sure we’re understanding each other. The pairing `p=("Graphs.jl", UUID("86223c79-3864-5bf0-83f7-82e725a168b6"))` has not changed. What’s new is that that package (`p`) got a new v1.4 version with a new API-- that of LightGraphs.jl.

Why does compat matter? Because that determines what version of `p` you get: the new v1.4 with the new API, or the older version.

---

<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: [October 22, 2021, 3:20pm UTC](https://discourse.julialang.org/t/lightgraphs-jl-transition/69526/38 "2021-10-22T15:20:04Z")

</div>

As far as I can tell, your `Project.toml` for Soss.jl is fine the way it is:

```julia
[compat]
# other stuff
Graphs = "0.10"

```

You can just leave it like that, make no changes to Soss.jl, and ignore v1.4 of Graphs.

---

<div class="post-metadata">

### Author: ![cscherrer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cscherrer/32/7631_2.png) [@cscherrer](https://discourse.julialang.org/u/cscherrer)
#### Post date: [October 22, 2021, 3:27pm UTC](https://discourse.julialang.org/t/lightgraphs-jl-transition/69526/39 "2021-10-22T15:27:38Z")

</div>

I see two packages:

Graphs → OldGraphs  
LightGraphs → Graphs

The original UUIDs were

- Graphs: `86223c79`
- LightGraphs: `093fc24a`

The new UUIDs seem to be

- OldGraphs: `86223c79`
- Graphs: `86223c79`

Ok, so now I’m back to thinking Pkg is fine, it’s the UUID managing that’s strange.

> [@cscherrer](#):
>
> But Soss is meant for people to build things on top of, and the UUID setup now means no one will be able to use the new Graph library with Soss unless I update everything.

And this still seems correct to me.

---

<div class="post-metadata">

### Author: ![cscherrer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cscherrer/32/7631_2.png) [@cscherrer](https://discourse.julialang.org/u/cscherrer)
#### Post date: [October 22, 2021, 3:28pm UTC](https://discourse.julialang.org/t/lightgraphs-jl-transition/69526/40 "2021-10-22T15:28:15Z")

</div>

Say a user wants to use Graphs 1.4 with Soss. Would that work?

---

<div class="post-metadata">

### Author: ![ericphanson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ericphanson/32/215186_2.png) [@ericphanson](https://discourse.julialang.org/u/ericphanson)
#### Post date: [October 22, 2021, 3:32pm UTC](https://discourse.julialang.org/t/lightgraphs-jl-transition/69526/41 "2021-10-22T15:32:23Z")

</div>

Yep, I think that’s all true (except I don’t totally know what you mean by UUID managing-- I think the name and UUID have to go together and not change separately from each other, otherwise I think things would break). The packages were basically merged.

> no one will be able to use the new Graph library with Soss unless I update everything

That’s true and I see how that is annoying. Someone (possibly you) could register OldGraphs.jl or a fork of it under a new name and you could depend on that I guess?

FWIW I think this is exactly the same situation as if the maintainers of Graphs.jl released a new very-breaking version (without any LightGraphs stuff being involved).

[Previous page](https://discourse.julialang.org/t/lightgraphs-jl-transition/69526.md?page=1)

[Next page](https://discourse.julialang.org/t/lightgraphs-jl-transition/69526.md?page=3)
