I want to create a function to push data into struct array. Here’s my code:

```
mutable struct graph{T}
data::AbstractArray{Array{T,1},1}
# addEdge(x,y)=push!(data[x],y) that doesn't work
end
# Creating method to assigns nodes
graph(nodes::T) where T = graph{T}([[] for i=1:nodes])
newGraph=graph(5)
```

I get that:

```
julia> newGraph=graph(5)
graph{Int64}(Array{Int64,1}[[], [], [], [], []])
```

and I can push elements like that:

```
push!(graph.data[1], 3)
```

but I want to do it in that way:

```
graph.addEdge(1,3)
```

and later input in the same way BFS or DFS algorithm functions, something like:

```
graph.BFS(2)
```

which will print the result of BFS (“2” is the root node in that case).

Do you know the way to do this?