MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / IsReachable

Function IsReachable

tensorflow/compiler/jit/graphcycles/graphcycles_test.cc:43–59  ·  view source on GitHub ↗

Return whether "to" is reachable from "from".

Source from the content-addressed store, hash-verified

41
42// Return whether "to" is reachable from "from".
43static bool IsReachable(Edges *edges, int from, int to,
44 std::unordered_set<int> *seen) {
45 seen->insert(from); // we are investigating "from"; don't do it again
46 if (from == to) return true;
47 for (int i = 0; i != edges->size(); i++) {
48 Edge *edge = &(*edges)[i];
49 if (edge->from == from) {
50 if (edge->to == to) { // success via edge directly
51 return true;
52 } else if (seen->find(edge->to) == seen->end() && // success via edge
53 IsReachable(edges, edge->to, to, seen)) {
54 return true;
55 }
56 }
57 }
58 return false;
59}
60
61static void PrintNodes(Nodes *nodes) {
62 LOG(INFO) << "NODES (" << nodes->size() << ")";

Callers 4

PrintTransitiveClosureFunction · 0.85
CheckTransitiveClosureFunction · 0.85
TESTFunction · 0.85
IsConnectedMethod · 0.85

Calls 4

insertMethod · 0.45
sizeMethod · 0.45
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected