public boolean containsEdge(ExecutableMethod sourceVertex, ExecutableMethod targetVertex) { return graph.containsEdge(sourceVertex, targetVertex); }
/** * <p>containsEdge</p> * * @param v1 a V object. * @param v2 a V object. * @return a boolean. */ public boolean containsEdge(V v1, V v2) { return graph.containsEdge(v1, v2); }
/** * <p>containsEdge</p> * * @param e a E object. * @return a boolean. */ public boolean containsEdge(E e) { return graph.containsEdge(e); // TODO this seems to be buggy, at least // for ControlFlowEdges }
public boolean containsEdge(DirectedEdge<ExecutableMethod> e) { return graph.containsEdge(e); }
public boolean containsEdge(ExecutableMethod sourceVertex, ExecutableMethod targetVertex) { return graph.containsEdge(sourceVertex, targetVertex); }
public boolean containsEdge(DirectedEdge<ExecutableMethod> e) { return graph.containsEdge(e); }
@Override public boolean accept(Set<T> each) { if (each.size() > 1) { // multi-vertex strongly-connected component is a cycle return true; } // vertex with an edge to itself is a cycle T vertex = each.iterator().next(); return graph.containsEdge(vertex, vertex); } });
@Override public boolean accept(Set<T> each) { if (each.size() > 1) { // multi-vertex strongly-connected component is a cycle return true; } // vertex with an edge to itself is a cycle T vertex = each.iterator().next(); return graph.containsEdge(vertex, vertex); } });
/** * Is it possible to go from s1 -> s2? * * @param source * the source state. * @param target * the target state. * @return true if it is possible (edge exists in graph) to go from source to target. */ @GuardedBy("sfg") public boolean canGoTo(StateVertex source, StateVertex target) { synchronized (sfg) { return sfg.containsEdge(source, target) || sfg.containsEdge(target, source); } }
static public <V, E> void transitiveReduct(DirectedGraph<V, E> g) { final Set<V> cycles = new CycleDetector<V, E>(g).findCycles(); checkArgument(cycles.isEmpty(), cycles); // final Set<V> vertices = ImmutableSet.copyOf(g.vertexSet()); for (V v1 : g.vertexSet()) { for (V v2 : Sets.difference(g.vertexSet(), ImmutableSet.of(v1))) { for (V v3 : Sets.difference(g.vertexSet(), ImmutableSet.of(v1, v2))) { if (g.containsEdge(v1, v2) && g.containsEdge(v2, v3) && g.containsEdge(v1, v3)) { // final boolean hasRev1 = g.containsEdge(v2, v1); // final boolean hasRev2 = g.containsEdge(v3, v2); // final boolean hasRev3 = g.containsEdge(v3, v1); // if (hasRev1 != hasRev2 || hasRev1 != hasRev3) { // throw new IllegalArgumentException("Found cycle in " // + v1 + v2 + v3 + "."); // } // if (!hasRev1) { g.removeEdge(v1, v3); // } } } } } } }
if (sfg.containsEdge(sourceVert, targetVert) && sfg.getAllEdges(sourceVert, targetVert).contains(clickable)) { return false;
private void createOrUpdateJavaElementWithDependencies(JavaElement javaElement, List<Path> files) { for (Path file : files) { final FileElement fileElement = new FileElement(file); if (!graph.containsVertex(fileElement)) { graph.addVertex(fileElement); } if (!graph.containsEdge(javaElement, fileElement)) { graph.addEdge(javaElement, fileElement); } } }
todo.add(pre); if (!subgraph.containsEdge(pre, current)) { subgraph.addEdge(pre, current);
todo.add(pre); if (!subgraph.containsEdge(pre, current)) { subgraph.addEdge(pre, current); todo.add(suc); if (!subgraph.containsEdge(current, suc)) { subgraph.addEdge(current, suc);
private void computeCallGraph() { callGraph = new DefaultDirectedGraph<Method, DefaultEdge>(DefaultEdge.class); for (Method m : methods.values()) { callGraph.addVertex(m); } for (Method m : methods.values()) { for (CfgBlock b : m.vertexSet()) { for (Statement s : b.getStatements()) { if (s instanceof CallStatement) { Method callee = ((CallStatement) s).getCallTarget(); if (!callGraph.containsEdge(m, callee)) { callGraph.addEdge(m, callee); } } } } } }
private boolean addImport(JavaElement javaElementParentClass, String importz) { if (coreJava.shouldBeIncluded(importz)) { JavaElement importClass = new JavaElement(importz); if (!importClass.equals(javaElementParentClass)) { if (!graph.containsVertex(importClass)) { graph.addVertex(importClass); } // This condition is required because we are flattening imports in graph if (!graph.containsEdge(javaElementParentClass, importClass)) { graph.addEdge(javaElementParentClass, importClass); return true; } } } return false; }