4
我想有擴展的圖形,能夠增加頂點和邊,並運行dijkstra_shortest_paths
算法中。 我無法找到正確的方式來定義圖形,以便dijkstra_shortest_paths
可以工作。 以下是我的嘗試。朱莉婭圖表,dijkstra_shortest_paths
using Graphs
g1= graph(ExVertex[], ExEdge{ExVertex}[], is_directed=false)
dist_key = "dist"
v1 = add_vertex!(g1, "a")
v2 = add_vertex!(g1, "b")
v3 = add_vertex!(g1, "c")
e12 = add_edge!(g1, v1, v2)
e12.attributes[dist_key]=1.0
e13 = add_edge!(g1, v1, v3)
e13.attributes[dist_key]=1.0
e23 = add_edge!(g1, v2, v3)
e23.attributes[dist_key]=1.0
epi = AttributeEdgePropertyInspector{Float64}(dist_key)
dijkstra_shortest_paths(g1, epi, ["a"])
錯誤消息:
dijkstra_shortest_paths has no method matching dijkstra_shortest_paths(::GenericGraph{ExVertex,ExEdge{ExVertex},Array{ExVertex,1},Array{ExEdge{ExVertex},1},Array{Array{ExEdge{ExVertex},1},1}}, ::AttributeEdgePropertyInspector{Float64}, ::Array{ASCIIString,1})
我不知道爲什麼這有兩個密切的選票和一個-1(我剛剛積極抵制),這是一個完全合理的問題。 – IainDunning 2014-12-06 01:56:25