ConsistencyParameterization implements Parameterization { public static Map<Study, Treatment> findStudyBaselines(Hypergraph<Treatment, Study> studyGraph, Tree<Treatment, FoldedEdge<Treatment, Study>> tree) { Map<Study, Treatment> map = new HashMap<Study, Treatment>(); for (Study s : studyGraph.getEdges()) { map.put(s, findMaxDegreeVertex(tree, studyGraph.getIncidentVertices(s))); } return map; } ConsistencyParameterization(Network network, Tree<Treatment, FoldedEdge<Treatment, Study>> tree, Map<Study, Treatment> baselines); static ConsistencyParameterization create(Network network); static Tree<Treatment, FoldedEdge<Treatment, Study>> findSpanningTree(UndirectedGraph<Treatment, FoldedEdge<Treatment, Study>> cGraph); static Map<Study, Treatment> findStudyBaselines(Hypergraph<Treatment, Study> studyGraph, Tree<Treatment, FoldedEdge<Treatment, Study>> tree); List<NetworkParameter> getParameters(); static List<NetworkParameter> getBasicParameters(Tree<Treatment, FoldedEdge<Treatment, Study>> tree); Map<NetworkParameter, Integer> parameterize(Treatment ta, Treatment tb); Treatment getStudyBaseline(Study s); List<List<Pair<Treatment>>> parameterizeStudy(Study s); Graph<Treatment, FoldedEdge<Treatment, Study>> getBasicParameterTree();  }
@Test public void testFindStudyBaselines() { Network network = new Network(); network.getTreatments().addAll(Arrays.asList(d_ta, d_tb, d_tc, d_td, d_te, d_tf)); Study s1 = new Study("1"); s1.getMeasurements().addAll(Arrays.asList(new Measurement(d_tc), new Measurement(d_tf))); Study s2 = new Study("2"); s2.getMeasurements().addAll(Arrays.asList(new Measurement(d_tb), 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_te), new Measurement(d_tf))); network.getStudies().addAll(Arrays.asList(s1, s2, s3)); Hypergraph<Treatment, Study> studyGraph = NetworkModel.createStudyGraph(network); UndirectedGraph<Treatment, FoldedEdge<Treatment, Study>> cGraph = NetworkModel.createComparisonGraph(studyGraph); Tree<Treatment, FoldedEdge<Treatment, Study>> tree = ConsistencyParameterization.findSpanningTree(cGraph); assertEquals(d_tc, tree.getRoot()); assertNotNull(tree.findEdge(d_tc, d_tf)); assertNotNull(tree.findEdge(d_tc, d_tb)); assertNotNull(tree.findEdge(d_tc, d_td)); assertNotNull(tree.findEdge(d_tf, d_te)); assertNotNull(tree.findEdge(d_tf, d_ta)); Map<Study, Treatment> baselines = ConsistencyParameterization.findStudyBaselines(studyGraph, tree); assertEquals(d_tc, baselines.get(s1)); assertEquals(d_tc, baselines.get(s2)); assertEquals(d_tf, baselines.get(s3)); }