@Override public void elemChosen(NodeDescriptor element) { CustomVisualizationViewer visualisator = handler.getVisualizator(); visualisator.jumpToPlace(visualisator.getGraphLayout().transform(element)); for (NodeDescriptor node : graph.getVertices()) { node.setNodeColour(NodeColours.NOT_RESULT_COLOUR); } element.setNodeColour(NodeColours.RESULT_COLOUR); }
private void addRuleNodes(boolean[] filter) { Iterator<String> e = edgeList.iterator(); while (e.hasNext()) { graph.removeEdge(e.next()); } Iterator<String> n = nodeList.iterator(); while (n.hasNext()) { graph.removeVertex(n.next()); } edgeList.clear(); nodeList.clear(); toolTipInfos.clear(); asPremise.clear(); asConclusion.clear(); int ruleIndex = 1; for (int r = 0; r < rules.getNumberOfRules(); r++) { if (filter[r]) { AssociationRule rule = rules.getRule(r); // define conjunction node String conjunctionNode = "Rule " + ruleIndex + " (" + Tools.formatNumber(rule.getTotalSupport()) + " / " + Tools.formatNumber(rule.getConfidence()) + ")"; toolTipInfos.put( conjunctionNode, "<html><b>Rule " + ruleIndex + "</b><br>" + SwingTools.addLinebreaks( rule.toPremiseString() + " --> " + rule.toConclusionString()) + "<br><b>Support:</b> " + rule.getTotalSupport() + "<br><b>Confidence:</b> " + rule.getConfidence() + "<br><b>Lift:</b> " + rule.getLift() + "<br><b>Gain:</b> " + rule.getGain() + "<br><b>Conviction:</b> " + rule.getConviction() + "<br><b>Laplace:</b> " + rule.getLaplace() + "<br><b>Ps:</b> " + rule.getPs() + "</html>"); nodeList.add(conjunctionNode); // add premise nodes Iterator<Item> p = rule.getPremiseItems(); while (p.hasNext()) { Item premiseItem = p.next(); String edgeId = edgeFactory.create(); edgeList.add(edgeId); nodeList.add(premiseItem.toString()); graph.addEdge(edgeId, premiseItem.toString(), conjunctionNode); List<String> premiseList = asPremise.get(premiseItem.toString()); if (premiseList == null) { premiseList = new LinkedList<String>(); asPremise.put(premiseItem.toString(), premiseList); } premiseList.add("Rule " + ruleIndex); } // add conclusion nodes Iterator<Item> c = rule.getConclusionItems(); while (c.hasNext()) { Item conclusionItem = c.next(); String edgeId = edgeFactory.create(); edgeList.add(edgeId); nodeList.add(conclusionItem.toString()); graph.addEdge(edgeId, conjunctionNode, conclusionItem.toString()); List<String> conclusionList = asConclusion.get(conclusionItem.toString()); if (conclusionList == null) { conclusionList = new LinkedList<String>(); asConclusion.put(conclusionItem.toString(), conclusionList); } conclusionList.add("Rule " + ruleIndex); } } ruleIndex++; } }
@Override public void clearResults() { recolour(graph.getVertices()); }