Skip to content
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

testing #1295 Fix Term Context graph for classification #1303

Merged
merged 1 commit into from
Mar 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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