new DirectedWeightedMultigraph<Node, LabeledLink>(LabeledLink.class);
for (Node n : steinerNodes)
tree.addVertex(n);
SemanticModel sm = new SemanticModel(new RandomGUID().toString(), tree);
SortableSemanticModel sortableSemanticModel = new SortableSemanticModel(sm, null);
sortableSemanticModels.add(sortableSemanticModel);
return sortableSemanticModels;
}
logger.info("graph nodes: " + this.graphBuilder.getGraph().vertexSet().size());
logger.info("graph links: " + this.graphBuilder.getGraph().edgeSet().size());
logger.info("number of steiner sets: " + candidateSteinerSets.numberOfCandidateSets());
// logger.info("updating weights according to training data ...");
// long start = System.currentTimeMillis();
// this.updateWeights();
// long updateWightsElapsedTimeMillis = System.currentTimeMillis() - start;
// logger.info("time to update weights: " + (updateWightsElapsedTimeMillis/1000F));
logger.info("computing steiner trees ...");
int number = 1;
for (SteinerNodes sn : candidateSteinerSets.getSteinerSets()) {
if (sn == null) continue;
logger.debug("computing steiner tree for steiner nodes set " + number + " ...");
logger.debug(sn.getScoreDetailsString());
number++;
// logger.info("START ...");
List<DirectedWeightedMultigraph<Node, LabeledLink>> topKSteinerTrees;
if (this.graphBuilder instanceof GraphBuilderTopK)
topKSteinerTrees = ((GraphBuilderTopK)this.graphBuilder).getTopKSteinerTrees(sn.getNodes(), ModelingConfiguration.getMaxCandidateModels());
else
{
topKSteinerTrees = new LinkedList<DirectedWeightedMultigraph<Node, LabeledLink>>();
SteinerTree steinerTree = new SteinerTree(
new AsUndirectedGraph<Node, DefaultLink>(this.graphBuilder.getGraph()), Lists.newLinkedList(sn.getNodes()));
WeightedMultigraph<Node, DefaultLink> t = steinerTree.getDefaultSteinerTree();
TreePostProcess treePostProcess = new TreePostProcess(this.graphBuilder, t);
if (treePostProcess.getTree() != null)
topKSteinerTrees.add(treePostProcess.getTree());
}
// System.out.println(GraphUtil.labeledGraphToString(treePostProcess.getTree()));
// logger.info("END ...");
for (DirectedWeightedMultigraph<Node, LabeledLink> tree: topKSteinerTrees) {
if (tree != null) {
// System.out.println();
SemanticModel sm = new SemanticModel(new RandomGUID().toString(),
tree,
columnNodes,
sn.getMappingToSourceColumns()
);
SortableSemanticModel sortableSemanticModel =
new SortableSemanticModel(sm, sn);
sortableSemanticModels.add(sortableSemanticModel);
System.out.println(GraphUtil.labeledGraphToString(sm.getGraph()));
System.out.println(sortableSemanticModel.getLinkCoherence().printCoherenceList());
}
}
if (number == ModelingConfiguration.getMaxCandidateModels())
break;