Skip to content

Commit

Permalink
Merge pull request #1303 from VirtualFlyBrain/feature/1295
Browse files Browse the repository at this point in the history
testing #1295 Fix Term Context graph for classification
  • Loading branch information
Robbie1977 authored Mar 11, 2022
2 parents 6473baa + acd651e commit dc90b1e
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions components/interface/VFBGraph/QueryParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,21 +60,24 @@ export function queryParser (e) {
let targetNode = nodesMap.get(n[i].target);

if (targetNode !== undefined) {
// Create new link for graph
let link = { source: sourceNode, name : n[i].label, target: targetNode, targetNode: targetNode };
links.push( link );
let match = links.find( link => ( link.target === sourceNode && link.source === targetNode ) || ( link.target === targetNode && link.source === sourceNode ));
if ( !match ){
// Create new link for graph
let link = { source: sourceNode, name : n[i].label, target: targetNode, targetNode: targetNode };
links.push( link );

// Assign neighbors to nodes and links
!sourceNode.neighbors && (sourceNode.neighbors = []);
!targetNode.neighbors && (targetNode.neighbors = []);
sourceNode.neighbors.push(targetNode);
targetNode.neighbors.push(sourceNode);
// Assign neighbors to nodes and links
!sourceNode.neighbors && (sourceNode.neighbors = []);
!targetNode.neighbors && (targetNode.neighbors = []);
sourceNode.neighbors.push(targetNode);
targetNode.neighbors.push(sourceNode);

// Assign links to nodes
!sourceNode.links && (sourceNode.links = []);
!targetNode.links && (targetNode.links = []);
sourceNode.links.push(link);
targetNode.links.push(link);
// Assign links to nodes
!sourceNode.links && (sourceNode.links = []);
!targetNode.links && (targetNode.links = []);
sourceNode.links.push(link);
targetNode.links.push(link);
}
}
}
}
Expand Down

0 comments on commit dc90b1e

Please sign in to comment.