Hello,

I am a researcher studying structural brain networks of stroke patients. I have some connectomes which are given as symmetric weighted matrices, e.g. (as a random example)

```
julia> X = rand(300,300); C = Symmetric((X + transpose(X)) / 2 - Diagonal(X))
```

I want to create a MetaGraph in which the edges have the weights in the matrix. In addition, I have a list of anatomical names for the 300 brain regions in the connectome, which I would like to serve as labels for the nodes. I can’t find where the documentation tells us how to do this. Any help would be greatly appreciated.

Thanks so much,

Philip

I’m not aware of a function to load a `MetaGraph`

with weights from an Array. You can do something like this to achieve what you are looking for.

```
function weightedmetagraph(C)
g=MetaGraph(size(C,1))
for ind in CartesianIndices(C)
if ind[1] != ind[2]
add_edge!(g,ind[1],ind[2],:weight,C[ind])
end
end
g
end
```

As for labels, you either have to set up a label when the vertex is added with

`add_vertex!(g,:label,"Node Label")`

, or after the fact with

`set_prop!(g, vertex, :label, "Node Label")`

.

The `:weight`

label is the only label that has prescribed functionality, but that can also be changed with the `weightfield!`

function.