# Load graphml with LightGraphs

**URL:** <https://discourse.julialang.org/t/load-graphml-with-lightgraphs/110590>\
**Category:** Graphs\
**Tags:** lightgraphs, graphio\
**Created:** [February 22, 2024, 4:10pm UTC](https://discourse.julialang.org/t/load-graphml-with-lightgraphs/110590 "2024-02-22T16:10:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andromeda258](https://avatars.discourse-cdn.com/v4/letter/a/f19dbf/32.png) [@Andromeda258](https://discourse.julialang.org/u/Andromeda258)\
**Post date:** [February 22, 2024, 4:10pm UTC](https://discourse.julialang.org/t/load-graphml-with-lightgraphs/110590/1 "2024-02-22T16:10:10Z")

</div>

I want to load a graphml graph as LightGraphs SimpleGraphs. This is the code I am using:  
`  
using LightGraphs  
using GraphIO

g = loadgraph(“graph.graphml”, GraphMLFormat())  
’  
But I got this error:  
·  
ERROR: UndefVarError: `GraphMLFormat` not defined  
·  
How can I fix this?

---

<div class="post-metadata">

**Author:** ![cormullion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cormullion/32/49131_2.png) [@cormullion](https://discourse.julialang.org/u/cormullion)\
**Post date:** [February 22, 2024, 4:34pm UTC](https://discourse.julialang.org/t/load-graphml-with-lightgraphs/110590/2 "2024-02-22T16:34:34Z")

</div>

Some of the comments in this thread

> [@Read graphml](https://discourse.julialang.org/t/read-graphml/91085):
>
> I have graphs in Graphml format and I am trying to read the graph as follow loadgraph("tailorS1.graphml",graph,GraphIO.GraphML.GraphMLFormat()) but I got the following error: LoadError: UndefVarError: GraphML not defined

might be applicable to you. For example, use Graphs,jl, not LightGraphs.jl, etc…

---

<div class="post-metadata">

**Author:** ![Andromeda258](https://avatars.discourse-cdn.com/v4/letter/a/f19dbf/32.png) [@Andromeda258](https://discourse.julialang.org/u/Andromeda258)\
**Post date:** [February 23, 2024, 4:00pm UTC](https://discourse.julialang.org/t/load-graphml-with-lightgraphs/110590/3 "2024-02-23T16:00:44Z")

</div>

I read this. It works when I use Graphs.jl rather than LightGraphs.jl. I am just wondering if I can directly load graph with LgihtGraphs.

---

<div class="post-metadata">

**Author:** ![cormullion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cormullion/32/49131_2.png) [@cormullion](https://discourse.julialang.org/u/cormullion)\
**Post date:** [February 23, 2024, 4:15pm UTC](https://discourse.julialang.org/t/load-graphml-with-lightgraphs/110590/4 "2024-02-23T16:15:13Z")

</div>

LightGraphs was the name of a graphs package that was developed between 2015 and 2021. The principal author moved on to other things. But the package was renamed as Graphs.jl, and all development (including bug fixes and improvements! :)) since then has been based on Graphs.jl. Unfortunately “LightGraphs” still turns up in searches … 🤷🏻‍♂️

---

<div class="post-metadata">

**Author:** ![Andromeda258](https://avatars.discourse-cdn.com/v4/letter/a/f19dbf/32.png) [@Andromeda258](https://discourse.julialang.org/u/Andromeda258)\
**Post date:** [February 25, 2024, 6:15am UTC](https://discourse.julialang.org/t/load-graphml-with-lightgraphs/110590/5 "2024-02-25T06:15:02Z")

</div>

Thanks a lot for your answer. I was asking for LightGraphs because it is used by a paper I need to use. I will just use Graphs.jl then…
