Skip to content
This repository was archived by the owner on Oct 21, 2021. It is now read-only.
This repository was archived by the owner on Oct 21, 2021. It is now read-only.

typealias AttributeDict Dict{UTF8String, Any} is restrictive? #211

@CorySimon

Description

@CorySimon

Can we change:

typealias AttributeDict Dict{UTF8String, Any}

to

typealias AttributeDict Dict{Any, Any}

?

I don't see the point in restricting the keys of the dictionary that is an edge attribute to UTF8String. In fact, why not just construct ExEdge with a Dict()? It seems to unnecessarily complicate things to introduce this AttributeDict type.

UPDATE:
For example, I want to store a tuple attribute to each edge. So I need to do:

attr = AttributeDict()
attr["uc_direction"] = (0, 1, 0)
edge = ExEdge(1, 3, 2, attr)

Oddly, this code:

edge = ExEdge(1, 3, 2, Dict(utf8("uc_direction") => (0, 1, 0)))

throws an error:

ERROR: MethodError: `convert` has no method matching convert(::Type{Graphs.ExEdge{V}}, ::Int64, ::Int64, ::Int64, ::Dict{UTF8String,Tuple{Int64,Int64,Int64}})
This may have arisen from a call to the constructor Graphs.ExEdge{V}(...),
since type constructors fall back to convert methods.
Closest candidates are:
  Graphs.ExEdge{V}(::Int64, ::V, ::V, ::Dict{UTF8String,Any})
  Graphs.ExEdge{V}(::Int64, ::V, ::V)
  call{T}(::Type{T}, ::Any)
  ...
 in call at essentials.jl:57

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions