use of edu.cmu.ml.proppr.graph.LearningGraphBuilder in project ProPPR by TeamCohen.
the class RedBlueGraph method setup.
@Before
public void setup() {
// if (!Logger.getRootLogger().getAllAppenders().hasMoreElements()) {
// BasicConfigurator.configure(); Logger.getRootLogger().setLevel(Level.WARN);
// }
LearningGraphBuilder lgb = new ArrayLearningGraphBuilder();
brGraph = (LearningGraph) lgb.create(new SimpleSymbolTable<String>());
lgb.index(1);
lgb.setGraphSize(brGraph, magicNumber * 2, -1, -1);
// brSRWs = new ArrayList<SRW>();
// Collections.addAll(brSRWs, new L2SqLossSRW(), new L2SqLossSRW(), new L2SqLossSRW());
{
int u = nodes.getId("b0"), v = nodes.getId("r0");
HashMap<String, Double> ff = new HashMap<String, Double>();
ff.put("fromb", 1.0);
ff.put("tor", 1.0);
lgb.addOutlink(brGraph, u, makeOutlink(lgb, ff, v));
ff = new HashMap<String, Double>();
ff.put("fromr", 1.0);
ff.put("tob", 1.0);
lgb.addOutlink(brGraph, v, makeOutlink(lgb, ff, u));
}
addColor(lgb, brGraph, magicNumber, "r");
addColor(lgb, brGraph, magicNumber, "b");
// save sets of red and blue nodes
reds = new TreeSet<String>();
blues = new TreeSet<String>();
for (int ui = 1; ui < (2 * magicNumber + 1); ui++) {
String u = nodes.getSymbol(ui);
if (u.startsWith("b"))
blues.add(u);
else
reds.add(u);
}
moreSetup(lgb);
lgb.freeze(brGraph);
// System.err.println("\n"+brGraphs.get(0).dump("r0"));
}
Aggregations