/** * @param pageID The pageID of the category. * @return The indegree of the given category. */ protected int getInDegree(int pageID) { return graph.inDegreeOf(pageID); }
public int inDegreeOf(ExecutableMethod arg0) { return graph.inDegreeOf(arg0); } public Set<DirectedEdge<ExecutableMethod>> incomingEdgesOf(ExecutableMethod arg0) {
public int inDegreeOf(ExecutableMethod arg0) { return graph.inDegreeOf(arg0); } public Set<DirectedEdge<ExecutableMethod>> incomingEdgesOf(ExecutableMethod arg0) {
/** * <p>inDegreeOf</p> * * @param node a V object. * @return a int. */ public int inDegreeOf(V node) { // TODO rename sth. like parentCount() if (node == null || !containsVertex(node)) return -1; return graph.inDegreeOf(node); }
/** * Returns the set of all sinks in 'g' * @param g Directed graph. * @return Set of all sinks in 'g'. */ public static <V> Set<V> getSources(DirectedGraph<V, ?> g) { Set<V> sources = new HashSet<V>(); for (V b : g.vertexSet()) { if (g.inDegreeOf(b)==0) { sources.add(b); } } return sources; }
/** * Get the unique source of 'g'. * @param g Graph with a unique source * @return The source of 'g', or an exception if the source is not unique. */ public static <V> V getSource(DirectedGraph<V, ?> g) { V source = null; for (V b : g.vertexSet()) { if (g.inDegreeOf(b)==0) { Verify.verify(source==null, String.format("More than one source: %n\t%s%n\t%s", source, b)); source = b; } } return source; }
public String getClusterLabel(Set<Action> cluster) { if (cluster.size() == 0) return "Unknown cluster type"; Action first = cluster.iterator().next(); if (first instanceof Insert) { Insert root = null; for (Action a : cluster) if (graph.inDegreeOf(a) == 0) root = (Insert) a; return root.format(src); } else if (first instanceof Move) { Move m = (Move) first; return "MOVE from " + m.getParent().toPrettyString(src); } else if (first instanceof Update) { Update u = (Update) first; return "UPDATE from " + first.getNode().getLabel() + " to " + u.getValue(); } else if (first instanceof Delete) { Delete root = null; for (Action a : cluster) if (graph.inDegreeOf(a) == 0) root = (Delete) a; return root.format(src); } else return "Unknown cluster type"; }