docstr: Core function to perform comparison.
  
  :param expected: A list of tuples (v1, v2, ((g1, o1), ..., (gN, oN)))
  with:
      - `v1` and `v2` two Variables (the graphs to be compared)
      - `gj` a `givens` dictionary to give as input to `is_same_graph`
      - `oj` the expected output of `is_same_graph(v1, v2, givens=gj)`
  
  This function also tries to call `is_same_graph` by inverting `v1` and
  `v2`, and ensures the output remains the same.
docstr_tok: ["Core","function","to","perform","comparison",".",":","param","expected",":","A","list","of","tuples","(","v1",",","v2",",","(","(","g1",",","o1",")",",","...",",","(","gN",",","oN",")",")",")","with",":","-","`","v1","`","and","`","v2","`","two","Variables","(","the","graphs","to","be","compared",")","-","`","gj","`","a","`","givens","`","dictionary","to","give","as","input","to","`","is_same_graph","`","-","`","oj","`","the","expected","output","of","`","is_same_graph","(","v1",",","v2",",","givens=gj",")","`","This","function","also","tries","to","call","`","is_same_graph","`","by","inverting","`","v1","`","and","`","v2","`",",","and","ensures","the","output","remains","the","same","."]
code: def check(self, expected):
      """
      Core function to perform comparison.
  
      :param expected: A list of tuples (v1, v2, ((g1, o1), ..., (gN, oN)))
      with:
          - `v1` and `v2` two Variables (the graphs to be compared)
          - `gj` a `givens` dictionary to give as input to `is_same_graph`
          - `oj` the expected output of `is_same_graph(v1, v2, givens=gj)`
  
      This function also tries to call `is_same_graph` by inverting `v1` and
      `v2`, and ensures the output remains the same.
      """
      for v1, v2, go in expected:
          for gj, oj in go:
              r1 = is_same_graph(v1, v2, givens=gj)
              assert r1 == oj
              r2 = is_same_graph(v2, v1, givens=gj)
              assert r2 == oj
  
file_path: pytensor/tests/graph/rewriting/test_utils.py
imports: from pytensor.graph.fg import FunctionGraph
  from pytensor.graph.rewriting.basic import graph_rewriter
  from pytensor.graph.rewriting.utils import is_same_graph, rewrite_graph
  from pytensor.tensor.math import neg
  from pytensor.tensor.type import vectors
label_desc: Use image node_id 1 for calling the TestIsSameGraph obj's underlying member method code with example usage: obj.check(expected) without return types