-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
edgeweight function much slower than edgeparse #38
Comments
@rohitvarkey, is this 20x slowdown consistent with the C call overhead, or is it due to the fact that edgeweight looks at all the edges of a vertex to find the edge, while edgeparse already has the edge and is just extracting the weight? |
I think the latter is probably the right explanation. The Julia C overhead is pretty small. But the |
Thank you for the explanation. Given the source and destination vertices of an edge, does Stinger have a function to retrieve its weight without traversing through all the edges of a vertex? If so, making it available in the Julia-Stinger would be highly desirable! |
This is unfortunately one area where STINGER performance is going to poor (at least on high-degree vertices). STINGER was designed with traversal in mind, so it's database-like query features are not great. Fixing this would require either a second index over the edges (prohibitively expensive) or a re-design of the linked list of blocks adjacency structure. We have had discussions about how we might approach this, but nothing has been prototyped yet. |
Right, the design of stinger is one based on implementing high performance parallel algorithms, which means that any operation on one edge is not optimized. What is the circumstance surrounding your need to get a single edge out of the stinger? Can we restructure the higher level algorithm to avoid this operation? |
I am considering the cases for streaming updates. For example, if the edge weight represents the number of interactions between two specific vertices, one may want to increment that weight when new interactions are observed. That will likely involve access and modification of the weight of a specific edge. In some cases though, the updates will involve all the edges to and from a certain vertex. Is there a fast way to retrieve the weights of all such edges? I am using the foralledges iterator to access each edge of a certain vertex now, but it's not clear how I can get their weights. |
I was looking through the stinger C source and it seems like there is another C function, called
The following will work to load the edges and the edge weights into Julia. But you will not be able to update the weights in the C memory as it the edge has been loaded into Julia already. julia> s = Stinger()
StingerGraphs.Stinger(Ptr{Void} @0x00000001e4e7b000)
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 Another way to solve this for fast updation of all vertices would be write your own |
|
Yes, the e.weight allowed me to access the edge weights during a traversal, which is fast. I noticed the weights are reported in one direction but not the other and opened up a separate issue on this. I'll follow up on the batch update in #40 |
Not sure this is an issue, but I noticed that retrieving edges weights using the edgeweight(g, src, dest, etype) function is significantly slower (~20 times) than just parsing the edge (i.e. edgeparse(edge)). Perhaps I am not retrieving the edge weight the right way? I am doing this on directed and weighted graphs with 1-10M edges. Thank you!
The text was updated successfully, but these errors were encountered: