I want to create a graph with custom vertex names. Is this possible with MetaGraphs.jl ?
using MetaGraphs
using LightGraphs
using GraphPlot
# Create empty graph
gm = MetaGraph()
# Add vertices with properties
add_vertex!(gm, :A, [7.2,8.6])
add_vertex!(gm, :B, [3.2,6.7])
add_vertex!(gm, :C, [6.3,3.9])
add_vertex!(gm, :D, [2.4,6.7])
gplot(gm, nodelabel = vertices(gm))
However is it possible for the vertex to have a name called :A
instead of 1
. Since in the next step I want to add an edge add_edge!(gm, :A,:B)
(This is incorrect, currently the names of the nodes 1,2,3... , so the way to create an edge is add_edge!(gm, 1,2)
)
In otherwords have A,B,C, ... instead of 1,2,3.