MCPcopy Create free account
hub / github.com/LFYSec/MScan / collectSCC

Method collectSCC

src/main/java/pascal/taie/util/graph/SCC.java:108–128  ·  view source on GitHub ↗
(N node, Deque<N> stack, Set<N> inStack, Graph<N> graph)

Source from the content-addressed store, hash-verified

106 }
107
108 private void collectSCC(N node, Deque<N> stack, Set<N> inStack, Graph<N> graph) {
109 List<N> scc = new ArrayList<>();
110 N v2;
111 do {
112 v2 = stack.pop();
113 inStack.remove(v2);
114 scc.add(v2);
115 } while (node != v2);
116 // Reverse SCC so that the nodes connected to predecessors
117 // (outside the SCC) will be listed ahead.
118 Collections.reverse(scc);
119 componentList.add(scc);
120 if (scc.size() > 1) {
121 trueComponentList.add(scc);
122 } else {
123 N n = scc.get(0);
124 if (graph.hasEdge(n, n)) {
125 trueComponentList.add(scc);
126 }
127 }
128 }
129
130 /**
131 * Validates whether the number of nodes in all components is

Callers 1

computeMethod · 0.95

Calls 5

removeMethod · 0.65
addMethod · 0.65
sizeMethod · 0.65
getMethod · 0.65
hasEdgeMethod · 0.65

Tested by

no test coverage detected