Skip to content

Commit

Permalink
fix: group node neighborhood (#2565)
Browse files Browse the repository at this point in the history
  • Loading branch information
itssharmasandeep authored Jan 2, 2024
1 parent 014a1ff commit e9cbabb
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import { uniq } from 'lodash-es';
import { TopologyEdge, TopologyNeighborhood, TopologyNode } from '../topology';
import { TopologyGroupNodeUtil } from './topology-group-node.util';

export class TopologyNeighborhoodFinder {
public neighborhoodForNode(node: TopologyNode): TopologyNeighborhood {
return {
nodes: uniq([node, ...node.edges.flatMap(edge => [edge.fromNode, edge.toNode])]),
nodes: uniq([
node,
...node.edges.flatMap(edge => [edge.fromNode, edge.toNode]),
...(TopologyGroupNodeUtil.isTopologyGroupNode(node) && node.expanded ? node.children : []),
]),
edges: [...node.edges],
};
}
Expand Down

0 comments on commit e9cbabb

Please sign in to comment.