diff --git a/src/components/Graph.jsx b/src/components/Graph.jsx index 011b205..a50a957 100644 --- a/src/components/Graph.jsx +++ b/src/components/Graph.jsx @@ -665,10 +665,6 @@ export default class GraphContainer extends Component { initializeSigma(){ var sigmaInstance, design; - sigma.classes.graph.addMethod('outNeighbors', function (id) { - return this.outNeighborsIndex.get(id).keyList(); - }); - sigmaInstance = new sigma( { container: 'graph' @@ -712,11 +708,11 @@ export default class GraphContainer extends Component { sigmaInstance.bind('hovers', function(e){ if (e.data.enter.nodes.length > 0) { if (appStore.endNode !== null) { - findGraphPath(this.state.sigmaInstance, false, e.data.enter.nodes[0].id); + findGraphPath(this.state.sigmaInstance, false, e.data.enter.nodes[0].id, []); } if (appStore.startNode !== null) { - findGraphPath(this.state.sigmaInstance, true, e.data.enter.nodes[0].id); + findGraphPath(this.state.sigmaInstance, true, e.data.enter.nodes[0].id, []); } sigmaInstance.refresh({'skipIndexation': true}); diff --git a/src/js/utils.js b/src/js/utils.js index 30ec882..0a5cd25 100644 --- a/src/js/utils.js +++ b/src/js/utils.js @@ -14,23 +14,24 @@ export function generateUniqueId(sigmaInstance, isNode) { } //Recursive function to highlight paths to start/end nodes -export function findGraphPath(sigmaInstance, reverse, nodeid) { - var target = reverse ? appStore.startNode : appStore.endNode; - //This is our stop condition for recursing +export function findGraphPath(sigmaInstance, reverse, nodeid, traversed) { + let target = reverse ? appStore.startNode : appStore.endNode; + traversed.push(nodeid); + //This is our stop condition for recursing if (nodeid !== target.id) { var edges = sigmaInstance.graph.adjacentEdges(nodeid); var nodes = reverse ? sigmaInstance.graph.inboundNodes(nodeid) : sigmaInstance.graph.outboundNodes(nodeid); - //Loop over the nodes near us and the edges connecting to those nodes + //Loop over the nodes near us and the edges connecting to those nodes $.each(nodes, function(index, node) { $.each(edges, function(index, edge) { var check = reverse ? edge.source : edge.target; - //If an edge is pointing in the right direction, set its color - //Push the edge into our store and then + //If an edge is pointing in the right direction, set its color + //Push the edge into our store and then node = parseInt(node); - if (check === node) { + if (check === node && !traversed.includes(node)) { edge.color = reverse ? 'blue' : 'red'; appStore.highlightedEdges.push(edge); - findGraphPath(sigmaInstance, reverse, node); + findGraphPath(sigmaInstance, reverse, node, traversed); } }); }); @@ -237,7 +238,6 @@ export function buildGplinkProps(rows){ }; } }); - console.log(datadict) return datadict; } @@ -247,6 +247,9 @@ export function buildACLProps(rows) { $.each(rows, function(index, row) { var b = row.ObjectName.toUpperCase(); var a = row.PrincipalName.toUpperCase(); + if (a === b){ + return; + } var btype = row.ObjectType.toTitleCase(); var atype = row.PrincipalType.toTitleCase(); var rel = row.ActiveDirectoryRights;