# A\* path on graph

**URL:** <https://discourse.julialang.org/t/a-path-on-graph/48340>\
**Category:** New to Julia\
**Created:** [October 14, 2020, 5:02am UTC](https://discourse.julialang.org/t/a-path-on-graph/48340 "2020-10-14T05:02:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon94806364](https://avatars.discourse-cdn.com/v4/letter/a/6f9a4e/32.png) [@anon94806364](https://discourse.julialang.org/u/anon94806364)\
**Post date:** [October 14, 2020, 5:02am UTC](https://discourse.julialang.org/t/a-path-on-graph/48340/1 "2020-10-14T05:02:26Z")

</div>

Newly introduced to Julia, after working with slow graph libraries in Python. I’m trying to find the shortest path through a graph, constructed through an adjacency matrix using `LightGraphs`.

Part of my confusion is whether if 1) I’m misunderstanding the syntax, or 2) I’m wrong to pass objects constructed in Python into packages written in Julia. For some reason I am unable to find even a simple path from a source and a target. Would someone be able to give a quick comment?

```julia
import numpy as np
import julia
from julia import LightGraphs, SimpleWeightedGraphs

# create transition matrix in numpy (Python)
trans_mat = np.array([[0, 3, 0], [0, 0, 1], [0, 0, 0]])
# create graph using Julia (LightGraphs)
g = SimpleWeightedGraphs.SimpleWeightedDiGraph(trans_mat)
# find shortest path using A_star (without heuristic, becomes Dijkstra)
LightGraphs.a_star(g, 1, 3)

>>> []

```

EDIT1: I found one such solution, which seems very cumbersome. Is there a more elegant solution?

```julia
source = 1
target = 3
LightGraphs.enumerate_paths(LightGraphs.dijkstra_shortest_paths(g, source), target))

```
