/// The example graphs of the efficient backdoor tests.
///
/// The graphs, the observed variables, the conditional variables, the
/// costs and the expected adjustment sets come from
/// `tests/causal_identifiers/example_graphs_efficient.py` of DoWhy 0.14.
/// The file is generated by
/// `_verify/gen_efficient_backdoor_testdata.py`; do not edit it by hand.

///|
/// One example graph with the adjustment sets it has to produce.
pub struct EfficientTestCase {
  nodes : Array[String]
  edges : Array[String]
  observed_nodes : Array[String]
  conditional_nodes : Array[String]
  costs : Array[(String, Double)]
  efficient : Array[String]?
  efficient_minimal : Array[String]?
  efficient_mincost : Array[String]?
}

///|
/// A new efficient backdoor test case.
pub fn EfficientTestCase::new(
  nodes : Array[String],
  edges : Array[String],
  observed_nodes : Array[String],
  conditional_nodes : Array[String],
  costs : Array[(String, Double)],
  efficient : Array[String]?,
  efficient_minimal : Array[String]?,
  efficient_mincost : Array[String]?,
) -> EfficientTestCase {
  {
    nodes,
    edges,
    observed_nodes,
    conditional_nodes,
    costs,
    efficient,
    efficient_minimal,
    efficient_mincost,
  }
}

///|
/// The ssr21_fig6_example_graph graph of the upstream test suite.
fn efficient_case_ssr21_fig6_example_graph() -> EfficientTestCase {
  EfficientTestCase::new(
    ["X", "F", "T", "U", "Y"],
    ["T->X", "X->Y", "U->Y", "U->F"],
    ["X", "Y", "T", "F"],
    ["T"],
    [],
    None,
    Some(["T"]),
    Some(["T"]),
  )
}

///|
/// The ssr21_fig5_example_graph graph of the upstream test suite.
fn efficient_case_ssr21_fig5_example_graph() -> EfficientTestCase {
  EfficientTestCase::new(
    ["X", "Y", "U", "Z1", "Z2"],
    ["X->Y", "Z1->X", "Z1->Z2", "U->Z2", "U->Y"],
    ["X", "Y", "Z1", "Z2"],
    [],
    [],
    None,
    Some([]),
    Some([]),
  )
}

///|
/// The ssr21_fig4_example_graph graph of the upstream test suite.
fn efficient_case_ssr21_fig4_example_graph() -> EfficientTestCase {
  EfficientTestCase::new(
    ["X", "Y", "T", "W1", "W2", "W3", "W4"],
    [
      "X->Y", "T->W1", "T->Y", "W1->X", "W2->W1", "W2->Y", "W3->W1", "W3->Y", "W4->Y",
    ],
    ["A", "Y", "T", "W1", "W2", "W3", "W4"],
    ["T"],
    [],
    Some(["T", "W2", "W3", "W4"]),
    Some(["T", "W2", "W3"]),
    Some(["T", "W1"]),
  )
}

///|
/// The ssr21_fig3_example_graph graph of the upstream test suite.
fn efficient_case_ssr21_fig3_example_graph() -> EfficientTestCase {
  EfficientTestCase::new(
    ["X", "F", "T", "U", "Y", "M"],
    ["T->X", "T->F", "F->X", "U->F", "U->Y", "X->M", "M->Y"],
    ["X", "Y", "T", "F", "M"],
    ["T"],
    [],
    Some(["F", "T"]),
    Some(["F", "T"]),
    Some(["F", "T"]),
  )
}

///|
/// The sr22_fig2_example_graph graph of the upstream test suite.
fn efficient_case_sr22_fig2_example_graph() -> EfficientTestCase {
  EfficientTestCase::new(
    ["L", "X", "K", "B", "Q", "R", "T", "M", "Y", "U", "F"],
    [
      "L->X", "X->M", "K->X", "B->K", "B->R", "Q->K", "Q->T", "R->Y", "T->Y", "M->Y",
      "U->Y", "U->F",
    ],
    ["L", "X", "B", "K", "Q", "R", "M", "T", "Y", "F"],
    ["L"],
    [("L", 1.0), ("B", 2.0), ("K", 4.0), ("Q", 1.0), ("R", 1.0), ("T", 1.0)],
    None,
    Some(["L", "R", "T"]),
    Some(["L", "R", "T"]),
  )
}

///|
/// The sr22_fig2_diffcosts_example_graph graph of the upstream test suite.
fn efficient_case_sr22_fig2_diffcosts_example_graph() -> EfficientTestCase {
  EfficientTestCase::new(
    ["L", "X", "K", "B", "Q", "R", "T", "M", "Y", "U", "F"],
    [
      "L->X", "X->M", "K->X", "B->K", "B->R", "Q->K", "Q->T", "R->Y", "T->Y", "M->Y",
      "U->Y", "U->F",
    ],
    ["L", "X", "B", "K", "Q", "R", "M", "T", "Y", "F"],
    ["L"],
    [("L", 1.0), ("B", 1.0), ("K", 4.0), ("Q", 1.0), ("R", 2.0), ("T", 1.0)],
    None,
    Some(["L", "R", "T"]),
    Some(["B", "L", "T"]),
  )
}

///|
/// The sr22_fig3_example_graph graph of the upstream test suite.
fn efficient_case_sr22_fig3_example_graph() -> EfficientTestCase {
  EfficientTestCase::new(
    ["X", "B", "Q", "R", "T", "Y"],
    ["B->X", "Q->X", "B->T", "Q->R", "T->Y", "R->Y", "X->Y"],
    ["X", "B", "Q", "R", "T", "Y"],
    [],
    [("B", 1.0), ("Q", 1.0), ("R", 2.0), ("T", 2.0)],
    Some(["R", "T"]),
    Some(["R", "T"]),
    Some(["B", "Q"]),
  )
}

///|
/// The alldiff_example_graph graph of the upstream test suite.
fn efficient_case_alldiff_example_graph() -> EfficientTestCase {
  EfficientTestCase::new(
    ["X", "Y", "W1", "W2", "W3", "W4", "W5", "W6", "W7", "W8", "W9", "K", "O"],
    [
      "K->X", "X->Y", "W1->K", "W2->K", "W3->K", "W1->W4", "W2->W5", "W3->W6", "W4->W7",
      "W5->W8", "W6->W9", "W7->Y", "W8->Y", "W9->Y", "O->Y",
    ],
    ["X", "Y", "K", "O", "W1", "W2", "W3", "W4", "W5", "W6", "W7", "W8", "W9"],
    [],
    [
      ("W1", 2.0),
      ("W2", 1.0),
      ("W3", 1.0),
      ("W4", 1.0),
      ("W5", 2.0),
      ("W6", 1.0),
      ("W7", 1.0),
      ("W8", 1.0),
      ("W9", 2.0),
      ("K", 11.0),
      ("O", 1.0),
    ],
    Some(["O", "W7", "W8", "W9"]),
    Some(["W7", "W8", "W9"]),
    Some(["W6", "W7", "W8"]),
  )
}

///|
/// The shrier_platt_2008 graph of the upstream test suite.
fn efficient_case_shrier_platt_2008() -> EfficientTestCase {
  EfficientTestCase::new(
    [
      "coach", "team motivation", "fitness", "pre-game prop", "intra-game prop",
      "neuromusc fatigue", "X", "previous injury", "contact sport", "genetics", "Y",
      "tissue disorder", "tissue weakness",
    ],
    [
      "coach->team motivation", "coach->fitness", "fitness->pre-game prop", "fitness->neuromusc fatigue",
      "team motivation->X", "team motivation->previous injury", "pre-game prop->X",
      "X->intra-game prop", "contact sport->previous injury", "contact sport->intra-game prop",
      "intra-game prop->Y", "genetics->fitness", "genetics->neuromusc fatigue", "genetics->tissue disorder",
      "tissue disorder->neuromusc fatigue", "tissue disorder->tissue weakness", "neuromusc fatigue->intra-game prop",
      "neuromusc fatigue->Y", "tissue weakness->Y",
    ],
    [
      "team motivation", "previous injury", "X", "coach", "fitness", "contact sport",
      "neuromusc fatigue", "tissue disorder", "Y",
    ],
    ["previous injury", "team motivation"],
    [],
    Some([
      "contact sport", "neuromusc fatigue", "previous injury", "team motivation",
      "tissue disorder",
    ]),
    Some([
      "neuromusc fatigue", "previous injury", "team motivation", "tissue disorder",
    ]),
    Some(["fitness", "previous injury", "team motivation"]),
  )
}

///|
/// The taheri_graph1 graph of the upstream test suite.
fn efficient_case_taheri_graph1() -> EfficientTestCase {
  EfficientTestCase::new(
    ["Z1", "Z2", "Z3", "M1", "M2", "X", "Y"],
    ["Z1->Z2", "Z2->Z3", "Z3->Y", "Z1->X", "X->M1", "M1->M2", "M2->Y"],
    ["Z1", "Z2", "Z3", "X", "Y", "M1", "M2"],
    [],
    [],
    Some(["Z3"]),
    Some(["Z3"]),
    Some(["Z3"]),
  )
}

///|
/// The taheri_graph2 graph of the upstream test suite.
fn efficient_case_taheri_graph2() -> EfficientTestCase {
  EfficientTestCase::new(
    ["Z1", "Z2", "Z3", "Z4", "Z5", "M1", "M2", "M3", "X", "Y", "U1", "U2"],
    [
      "Z1->Z2", "Z2->Z3", "Z3->Z4", "Z4->Z5", "Z5->Y", "Z1->X", "X->M1", "M1->M2",
      "M2->M3", "M3->Y", "U1->X", "U1->Z1", "U2->Z2", "U2->M1",
    ],
    ["Z1", "Z2", "Z3", "Z4", "Z5", "X", "Y", "M1", "M2", "M3"],
    [],
    [],
    Some(["Z1", "Z2", "Z5"]),
    Some(["Z1"]),
    Some(["Z1"]),
  )
}

///|
/// Every example graph of the upstream test suite.
pub fn efficient_cases() -> Array[EfficientTestCase] {
  [
    efficient_case_ssr21_fig6_example_graph(),
    efficient_case_ssr21_fig5_example_graph(),
    efficient_case_ssr21_fig4_example_graph(),
    efficient_case_ssr21_fig3_example_graph(),
    efficient_case_sr22_fig2_example_graph(),
    efficient_case_sr22_fig2_diffcosts_example_graph(),
    efficient_case_sr22_fig3_example_graph(),
    efficient_case_alldiff_example_graph(),
    efficient_case_shrier_platt_2008(),
    efficient_case_taheri_graph1(),
    efficient_case_taheri_graph2(),
  ]
}