public boolean isDirected() { return graphModel != null && !graphModel.isUndirected(); }
public Hits() { GraphController graphController = Lookup.getDefault().lookup(GraphController.class); if (graphController != null && graphController.getGraphModel() != null) { useUndirected = graphController.getGraphModel().isUndirected(); } }
@Override public void run() { Graph visibleGraph = model.getGraphVisible(); Graph fullGraph = model.getGraph(); final int nodesFull = fullGraph.getNodeCount(); final int nodesVisible = visibleGraph.getNodeCount(); final int edgesFull = fullGraph.getEdgeCount(); final int edgesVisible = visibleGraph.getEdgeCount(); final GraphType graphType = model.isDirected() ? GraphType.DIRECTED : model.isUndirected() ? GraphType.UNDIRECTED : GraphType.MIXED; SwingUtilities.invokeLater(new Runnable() { @Override public void run() { String visible = NbBundle.getMessage(ContextPanel.class, "ContextPanel.visible"); String nodeText = String.valueOf(nodesVisible); String edgeText = String.valueOf(edgesVisible); if (nodesFull != nodesVisible || edgesFull != edgesVisible) { nodeText += nodesFull > 0 ? " (" + formatter.format(nodesVisible / (double) nodesFull) + " " + visible + ")" : ""; edgeText += edgesFull > 0 ? " (" + formatter.format(edgesVisible / (double) edgesFull) + " " + visible + ")" : ""; } nodeLabel.setText(nodeText); edgeLabel.setText(edgeText); graphTypeLabel.setText(graphType.type); } }); } }