Codota Logo
SCCTarjan
Code IndexAdd Codota to your IDE (free)

How to use
SCCTarjan
in
org.kframework.utils.algorithms

Best Java code snippets using org.kframework.utils.algorithms.SCCTarjan (Showing top 5 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Point p =
  • Codota Iconnew Point(x, y)
  • Codota Iconnew Point()
  • Codota IconMouseEvent e;e.getPoint()
  • Smart code suggestions by Codota
}
origin: kframework/k

  public static void main(String[] args) {
    @SuppressWarnings("unchecked")
    List<Integer>[] g = new List[10];
    for (int i = 0; i < g.length; i++) {
      g[i] = new ArrayList<>();
    }
    g[0].add(1);
    g[0].add(2);
    g[2].add(1);
    g[1].add(2);
    g[3].add(2);
    g[4].add(3);
    g[5].add(4);
    g[6].add(5);
    g[7].add(6);
    g[8].add(9);
    g[9].add(7);


    List<List<Integer>> components = new SCCTarjan().scc(g);
    System.out.println(components);
  }
}
origin: kframework/k

public List<List<Integer>> scc(List<Integer>[] graph) {
  int n = graph.length;
  this.graph = graph;
  lowlink = new int[n];
  used = new boolean[n];
  stack = new ArrayList<>();
  components = new ArrayList<>();
  for (int u = 0; u < n; u++)
    if (!used[u])
      dfs(u);
  return components;
}
origin: kframework/k

List<List<Integer>> components = new SCCTarjan().scc(predecessors);
origin: kframework/k

void dfs(int u) {
  lowlink[u] = time++;
  used[u] = true;
  stack.add(u);
  boolean isComponentRoot = true;
  for (int v : graph[u]) {
    if (!used[v])
      dfs(v);
    if (lowlink[u] > lowlink[v]) {
      lowlink[u] = lowlink[v];
      isComponentRoot = false;
    }
  }
  if (isComponentRoot) {
    List<Integer> component = new ArrayList<>();
    while (true) {
      int k = stack.remove(stack.size() - 1);
      component.add(k);
      lowlink[k] = Integer.MAX_VALUE;
      if (k == u)
        break;
    }
    components.add(component);
  }
}
origin: kframework/k

List<List<Integer>> components = new SCCTarjan().scc(predecessors);
org.kframework.utils.algorithmsSCCTarjan

Most used methods

  • <init>
  • scc
  • dfs

Popular in Java

  • Updating database using SQL prepared statement
  • setRequestProperty (URLConnection)
  • getExternalFilesDir (Context)
  • setScale (BigDecimal)
    Returns a BigDecimal whose scale is the specified value, and whose value is numerically equal to thi
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • FileOutputStream (java.io)
    A file output stream is an output stream for writing data to aFile or to a FileDescriptor. Whether
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate(i
  • Locale (java.util)
    A Locale object represents a specific geographical, political, or cultural region. An operation that
  • PriorityQueue (java.util)
    An unbounded priority Queue based on a priority heap. The elements of the priority queue are ordered
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now