Prevent duplicate edges in Lightrag graph
- Check for reverse edge existence
This commit is contained in:
@@ -578,6 +578,9 @@ const useLightrangeGraph = () => {
|
|||||||
if (sigmaGraph.hasEdge(newEdge.source, newEdge.target)) {
|
if (sigmaGraph.hasEdge(newEdge.source, newEdge.target)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (sigmaGraph.hasEdge(newEdge.target, newEdge.source)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Add the edge to the sigma graph
|
// Add the edge to the sigma graph
|
||||||
newEdge.dynamicId = sigmaGraph.addDirectedEdge(newEdge.source, newEdge.target, {
|
newEdge.dynamicId = sigmaGraph.addDirectedEdge(newEdge.source, newEdge.target, {
|
||||||
|
Reference in New Issue
Block a user