# Problem LightGraphs creating graphs and accessing vertices LightGraphs

**URL:** https://discourse.julialang.org/t/problem-lightgraphs-creating-graphs-and-accessing-vertices-lightgraphs/40804
**Category:** Graphs
**Tags:** lightgraphs, metagraphs
**Created:** [June 5, 2020, 10:48am UTC](https://discourse.julialang.org/t/problem-lightgraphs-creating-graphs-and-accessing-vertices-lightgraphs/40804 "2020-06-05T10:48:47Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Florent\_Poux](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/florent_poux/32/15424_2.png) [@Florent\_Poux](https://discourse.julialang.org/u/Florent_Poux)
#### Post date: [June 5, 2020, 10:48am UTC](https://discourse.julialang.org/t/problem-lightgraphs-creating-graphs-and-accessing-vertices-lightgraphs/40804/1 "2020-06-05T10:48:47Z")

</div>

Hi,

I struggle to have a reliable behavior using Lightgraphs. Yesterday, I could plot some graphs based on some arrays I had, but impossible to use the command “vertices(G)” for example (returned: UndefVarError: vertices not defined).

Today, when I launched my script, it even stops at “G=Graph()” with error UndefVarError: Graph not defined.

I checked my packages, they are well installed:  
Pkg.add(“LightGraphs”)  
Pkg.add(“GraphPlot”)

Would someone have a solution?

---

<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: [June 5, 2020, 11:25am UTC](https://discourse.julialang.org/t/problem-lightgraphs-creating-graphs-and-accessing-vertices-lightgraphs/40804/2 "2020-06-05T11:25:49Z")

</div>

You might just need to do

```julia
using LightGraphs, GraphPlot

```

at the top of your script.
