Drops duplicate edges in non-MultiGraph PLC SGGraph
instances
#4658
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Graph input with duplicate edges intended for
Graph
/DiGraph
instances resulted in internal PLCSGGraph
instances with duplicate edges, which were effectively treated as MultiGraphs and caused incorrect results from algorithms likepagerank
.This PR sets the
drop_multi_edges
PLCSGGraph
ctor option to have PLC remove duplicate edges onSGGraph
creation.The overhead to drop duplicate edges for non-MultiGraphs is negligible, and in the case of a large test graph (wikipedia data, 37.5M nodes, 464.5M edges) resulted in
an overall speedup for pagerank going from 12.2 seconds to 10.7 seconds on my workstation, likely due to fewer edges to processa minor slowdown from 10.5s to 10.7s. edit: after several re-runs, the pagerank runtime before the change settled to 10.5, and the runtime after the change was typically 10.7.A test was added that uses pagerank to ensure Graphs vs. MultiGraphs are handled correctly and duplicate edges are dropped as needed. The results when run without
drop_multi_edges
set:The same test passes when run with the changes in this PR to set
drop_multi_edges
.