Prevent duplicate edges in Lightrag graph
- Check for reverse edge existence
This commit is contained in:
parent
5e1c9f93ca
commit
07b13ee739
1 changed files with 3 additions and 0 deletions
|
|
@ -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, {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue