/** * Get the neighbors of a given node. * The category graph is treated as an undirected graph. * @param node the reference node. * @return The set of category nodes that are neighbors of this category. */ protected Set<Integer> getNeighbors(int node) { Set<Integer> neighbors = new HashSet<Integer>(); Set<DefaultEdge> edges = undirectedGraph.edgesOf(node); for (DefaultEdge edge : edges) { if (undirectedGraph.getEdgeSource(edge) != node) { neighbors.add(undirectedGraph.getEdgeSource(edge)); } if (undirectedGraph.getEdgeTarget(edge) != node) { neighbors.add(undirectedGraph.getEdgeTarget(edge)); } } return neighbors; }
PossibleTopology.Bus bus1 = graph.getEdgeSource(e); PossibleTopology.Bus bus2 = graph.getEdgeTarget(e); PossibleTopology.Bus bus1 = graph.getEdgeSource(e); PossibleTopology.Bus bus2 = graph.getEdgeTarget(e); uniqueTopo.getSwitches().add(new UniqueTopology.Switch(substationId + "_" + i++, bus1, bus2));