Set_indexing_prop!() in MetaGraph gives an error

Hi,

I am testing the ability to use MetaGraph to filter through a graph.

context:
node 1 is the table which I want to metaindex with the type : “Source”.
This seems to work fine until I want to set the index (linenumber 4 in the blurp)

T1 = star_graph(6)
T1_nodelabel = ["T1","C1.1","C1.2","C1.3","C1.4","C1.5"]
mg = MetaGraph(T1, 3.0)
set_prop!(mg, 1, :type, "Source")
set_indexing_prop!(mg, :type)
gplot(mg, nodelabel=T1_nodelabel, nodelabelsize= 0.1, nodelabelc ="white")

I get this erro message:

julia> set_indexing_prop!(mg, :type)
ERROR: MethodError: no method matching default_index_value(::Int64, ::Symbol, ::Set{String}; exclude=nothing)
Closest candidates are:
  default_index_value(::Integer, ::Symbol, ::Set{Any}; exclude) at C:\Users\achen\.julia\packages\MetaGraphs\SUjFO\src\MetaGraphs.jl:350
Stacktrace:
 [1] set_indexing_prop!(::MetaGraph{Int64,Float64}, ::Symbol; exclude::Nothing) at C:\Users\achen\.julia\packages\MetaGraphs\SUjFO\src\MetaGraphs.jl:378
 [2] set_indexing_prop!(::MetaGraph{Int64,Float64}, ::Symbol) at C:\Users\achen\.julia\packages\MetaGraphs\SUjFO\src\MetaGraphs.jl:370
 [3] top-level scope at REPL[57]:1

I can’t figure out what the problem is.

thanks in advance.

best,

I will reply on my own question since I think someone in the future might need this.

there are 2 problems here and none have to do with the actual syntax.

  1. it is not allowed in Metagraph as far as I can see, to only give 1 node a metaproperty. Its either all node or no nodes.
  2. And this one is kinda annoying and I find personally a little disappointing, the property description needs to be unique. So you CANNOT do a search index on :type if you only have two types and more then 2 nodes. So in this case you CAN give every node a type of either “Table” or “Column” but you CANNOT search on that via an index. I don’t know why they couldnt give an array of mutiple nodes back that fit the same filter ‘Column’, you can make a filter function. The flaw here goes quite deep. Lets say you have a family tree, you cannot use Metagraph out of the box to index search on terms like “father” or “son”…