MCPcopy Create free account
hub / github.com/tensorflow/tfjs / verifyGraph

Function verifyGraph

scripts/graph_utils.ts:37–47  ·  view source on GitHub ↗
(graph: Graph)

Source from the content-addressed store, hash-verified

35 * Verify that an object is a valid graph.
36 */
37export function verifyGraph(graph: Graph) {
38 const nodes = new Set(Object.keys(graph));
39 for (const [node, edges] of Object.entries(graph)) {
40 for (const edge of edges) {
41 if (!nodes.has(edge)) {
42 throw new Error(
43 `Graph edge ${edge} of node ${node} not found in the graph`);
44 }
45 }
46 }
47}
48
49/**
50 * Transpose a directed graph i.e. reverse the direction of the edges.

Callers 2

transposeGraphFunction · 0.85
topologicalSortFunction · 0.85

Calls 1

hasMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…