NodeSplitParameterization extends ConsistencyParameterization { public static List<BasicParameter> getSplittableNodes(Network network) { Hypergraph<Treatment, Study> studyGraph = NetworkModel.createStudyGraph(network); UndirectedGraph<Treatment, FoldedEdge<Treatment, Study>> cGraph = NetworkModel.createComparisonGraph(studyGraph); return getSplittableNodes(studyGraph, cGraph); } NodeSplitParameterization(Network network, BasicParameter splitNode, Tree<Treatment, FoldedEdge<Treatment, Study>> tree, Map<Study, Treatment> baselines); static NodeSplitParameterization create(Network network, BasicParameter split); static List<BasicParameter> getSplittableNodes(Network network); static List<BasicParameter> getSplittableNodes(Hypergraph<Treatment, Study> studyGraph, UndirectedGraph<Treatment, FoldedEdge<Treatment, Study>> cGraph); static boolean isSplittable(Hypergraph<Treatment, Study> studyGraph, Pair<Treatment> split); static Tree<Treatment, FoldedEdge<Treatment, Study>> findSpanningTree(UndirectedGraph<Treatment, FoldedEdge<Treatment, Study>> cGraph, BasicParameter split); static Map<Study, Treatment> findStudyBaselines(Hypergraph<Treatment, Study> studyGraph, Tree<Treatment, FoldedEdge<Treatment, Study>> tree, BasicParameter split); @Override List<NetworkParameter> getParameters(); @Override Map<NetworkParameter, Integer> parameterize(Treatment ta, Treatment tb); SplitParameter getDirectParameter(); SplitParameter getIndirectParameter(); Map<NetworkParameter, Integer> parameterizeIndirect(); @Override List<List<Pair<Treatment>>> parameterizeStudy(Study s); BasicParameter getSplitNode();  }
@Test public void testSplittableNodes() { assertEquals(Arrays.asList(new BasicParameter(d_ta, d_tb), new BasicParameter(d_ta, d_tc), new BasicParameter(d_tb, d_tc)), NodeSplitParameterization.getSplittableNodes(NetworkModel.createStudyGraph(d_network), NetworkModel.createComparisonGraph(d_network))); d_s3.getMeasurements().add(new Measurement(d_ta)); assertEquals(Arrays.asList(new BasicParameter(d_tb, d_tc)), NodeSplitParameterization.getSplittableNodes(NetworkModel.createStudyGraph(d_network), NetworkModel.createComparisonGraph(d_network))); }
@Test public void testSplittableNodesNone() { Study s1 = new Study("1"); s1.getMeasurements().addAll(Arrays.asList(new Measurement(d_ta), new Measurement(d_tb))); Study s2 = new Study("2"); s2.getMeasurements().addAll(Arrays.asList(new Measurement(d_ta), new Measurement(d_tc))); Network network = new Network(); network.getTreatments().addAll(Arrays.asList(d_ta, d_tb, d_tc)); network.getStudies().addAll(Arrays.asList(s1, s2)); assertEquals(Collections.emptyList(), NodeSplitParameterization.getSplittableNodes(NetworkModel.createStudyGraph(network), NetworkModel.createComparisonGraph(network))); }
@Test public void testSplittableNodesFourArm() { Study s1 = new Study("1"); s1.getMeasurements().addAll(Arrays.asList(new Measurement(d_ta), new Measurement(d_tb))); Study s2 = new Study("2"); s2.getMeasurements().addAll(Arrays.asList(new Measurement(d_tc), new Measurement(d_td))); Study s3 = new Study("3"); s3.getMeasurements().addAll(Arrays.asList(new Measurement(d_ta), new Measurement(d_tb), new Measurement(d_tc), new Measurement(d_td))); Network network = new Network(); network.getTreatments().addAll(Arrays.asList(d_ta, d_tb, d_tc, d_td)); network.getStudies().addAll(Arrays.asList(s1, s2, s3)); assertEquals(Arrays.asList(new BasicParameter(d_ta, d_tc), new BasicParameter(d_ta, d_td), new BasicParameter(d_tb, d_tc), new BasicParameter(d_tb, d_td)), NodeSplitParameterization.getSplittableNodes(NetworkModel.createStudyGraph(network), NetworkModel.createComparisonGraph(network))); }