stingergraph / StingerGraphs.jl

Julialang bindings to the STINGER graph database
http://www.stingergraph.com
Other
5 stars 3 forks source link

WIP: Add a function to update edge weights of a certain vertex #40

Open rohitvarkey opened 6 years ago

rohitvarkey commented 6 years ago

To solve the case in #38 where all edge weights of a vertex has to be updated.

@edward-kao can you try using this and see how it performs on your graph?

I wonder if wts should also store direction to prevent the wrong edge being updated.

rohitvarkey commented 6 years ago
julia> using StingerGraphs

julia> s = Stinger()
Oct 25 18:05:52  stinger[49621] <Warning>: stinger_new_full 827: Resizing stinger to fit into memory (detected as 4294967296)
StingerGraphs.Stinger(Ptr{Void} @0x0000000127c5c000)

julia> for i=1:5
                                              insert_edge!(s, 0, 0, i, i, 0)
                                          end

julia> foralledges(s, 0) do e, src, etype
                @show e.weight
         end
e.weight = 1
e.weight = 2
e.weight = 3
e.weight = 4
e.weight = 5

julia> wts = Dict{Int64, Int64}()
Dict{Int64,Int64} with 0 entries

julia> for i=1:5
           wts[i] = i
       end

julia> foralledgesupdatewts(s, 0, wts)

julia> foralledges(s, 0) do e, src, etype
                @show e.weight
          end
e.weight = 2
e.weight = 4
e.weight = 6
e.weight = 8
e.weight = 10
ehein6 commented 6 years ago

This solves a very specific problem. I would rather that we find a way to make the edge weights writable directly from Julia.

edward-kao commented 6 years ago

I checked out this branch with the foralledgeupdates function. I can see it in traversal.jl, but after rebuilding by running /deps/build.jl, foralledgesupdatewts is still not defined. Maybe I am not re-building Julia-Stinger correctly?

rohitvarkey commented 6 years ago

@ehein6 I agree. This is more of a stopgap for now.

@edward-kao That's pretty weird. You should need to run deps/build.jl only when the STINGER version is updated. Is the cloned package which you've checked out in your Julia package dir (typically ~/.julia/0.6/StingerGraphs)?