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

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

Open
CorySimon opened this issue Dec 11, 2015 · 6 comments
Open

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

CorySimon opened this issue Dec 11, 2015 · 6 comments

Comments

@CorySimon
Copy link

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
@kmsquire
Copy link
Contributor

@CorySimon, as you can see, Graphs.jl hasn't been getting much attention recently.

Are you still interested in this issue? If so, are you able to submit a pull request which addresses this problem? If you're stuck and looking for hints, I might be able to provide some.

@juliohm
Copy link

juliohm commented Feb 26, 2016

@kmsquire, this package is not maintained anymore? What is the defacto standard package for graphs in Julia?

@mlubin
Copy link
Contributor

mlubin commented Feb 26, 2016

LightGraphs.jl is actively maintained

@juliohm
Copy link

juliohm commented Feb 26, 2016

Thank you @mlubin, I assume it took the place of Graphs.jl?

@mlubin
Copy link
Contributor

mlubin commented Feb 26, 2016

The functionality of Graphs is not entirely contained in LightGraphs (and likely the reverse statement is true as well), so I'll let you decide which you prefer.

@juliohm
Copy link

juliohm commented Feb 26, 2016 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants