# Vertices that direct an edge to itself, using LightGraphs.jl, DiGraph()

**URL:** <https://discourse.julialang.org/t/vertices-that-direct-an-edge-to-itself-using-lightgraphs-jl-digraph/16403>\
**Category:** Visualization\
**Created:** [October 16, 2018, 1:38pm UTC](https://discourse.julialang.org/t/vertices-that-direct-an-edge-to-itself-using-lightgraphs-jl-digraph/16403 "2018-10-16T13:38:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![liubomyrv](https://avatars.discourse-cdn.com/v4/letter/l/f4b2a3/32.png) [@liubomyrv](https://discourse.julialang.org/u/liubomyrv)\
**Post date:** [October 16, 2018, 1:38pm UTC](https://discourse.julialang.org/t/vertices-that-direct-an-edge-to-itself-using-lightgraphs-jl-digraph/16403/1 "2018-10-16T13:38:47Z")

</div>

Hello Julia community. I am using `Julia v.0.6.4` to make visualization for a structural analysis of a linear system. And for this I am using graphs from `LightGraphs.jl` and specifically directed graphs function `DiGraph()`.  
I’ve got a problem with representation of vertices that direct an edge to itself. This is a diagonal elements on a matrix that is used for the graph creation. See example for better understanding:

```julia
using LightGraphs
using GraphPlot
A = [-4.36928 2.86758e-11 -0.000334885 7.71247e-6 -1.52591e-9;
      0.0 0.0 0.0 0.0 0.0;
      4.21327 3.43463e-10 -0.00401345 -1.10343e-5 1.47294e-9;
      0.0 0.0 997.0 0.0 0.0;
      0.0 0.0 0.0 0.0 0.0]
G = DiGraph(A)
gplot(G, nodelabel=1:size(A)[1])

```

![SelfEdges_ex](https://global.discourse-cdn.com/julialang/original/3X/e/c/ecd44d062017935457277bf63abba48957889c6e.png)

I showed the problematic edges with red circles. It is visible that sometimes it is really hard to notice them, e.g. self edge to vertex #3 is invisible due to other edges, however it exists which is seen from matrix A (i.e. A[3,3] element).  
I would like to ask if it somehow possible to make these edges look a bit different, e.g., as in the fig. below.  
 ![Vertex_ex](https://global.discourse-cdn.com/julialang/original/3X/e/b/eb1969a7bfb67025537e192d39bd1139d83113c3.png)  
I’ve seen that it is possible to manipulate with edges’ line width, color, arrow length or angle. And for now I’ve used a different color for such self edges. However, it would be interesting to know if it is possible to make this more efficient?

---

<div class="post-metadata">

**Author:** ![anon94023334](https://avatars.discourse-cdn.com/v4/letter/a/e274bd/32.png) [@anon94023334](https://discourse.julialang.org/u/anon94023334)\
**Post date:** [October 16, 2018, 6:53pm UTC](https://discourse.julialang.org/t/vertices-that-direct-an-edge-to-itself-using-lightgraphs-jl-digraph/16403/2 "2018-10-16T18:53:31Z")

</div>

You’re probably running into [Self-loops not correctly drawn · Issue #60 · JuliaGraphs/GraphPlot.jl · GitHub](https://github.com/JuliaGraphs/GraphPlot.jl/issues/60).

---

<div class="post-metadata">

**Author:** ![liubomyrv](https://avatars.discourse-cdn.com/v4/letter/l/f4b2a3/32.png) [@liubomyrv](https://discourse.julialang.org/u/liubomyrv)\
**Post date:** [October 18, 2018, 7:44am UTC](https://discourse.julialang.org/t/vertices-that-direct-an-edge-to-itself-using-lightgraphs-jl-digraph/16403/3 "2018-10-18T07:44:44Z")

</div>

Ok. Thanks. I’m looking forward for changes.
