Example #1
0
  protected static MoralGraphNode findSimplicialNode(MoralGraph graph) {
    ArrayList<GraphNode> nodes = graph.getNodes();
    MoralGraphNode node = null;

    for (int i = 0; i < nodes.size(); i++) {
      node = (MoralGraphNode) nodes.get(i);
      if (isSimplicialNode(node)) return node;
    }

    // No simplicial node exists return null
    return null;
  }
Example #2
0
  protected static MoralGraphNode findMinFillInNode(MoralGraph graph) {
    ArrayList<GraphNode> nodes = graph.getNodes();
    MoralGraphNode minFillInNode = null, node = null;
    int fillIns = 0, minFillIns = Integer.MAX_VALUE;

    for (int i = 0; i < nodes.size(); i++) {
      node = (MoralGraphNode) nodes.get(i);
      fillIns = numFillIns(node);

      if (fillIns < minFillIns) {
        minFillIns = fillIns;
        minFillInNode = node;
      }
    }

    return minFillInNode;
  }
Example #3
0
  protected static MoralGraphNode findBestNode(MoralGraph graph) {
    ArrayList<GraphNode> nodes = graph.getNodes();
    MoralGraphNode bestNode = null, node = null;
    long dom = 0, minDom = Long.MAX_VALUE;

    for (int i = 0; i < nodes.size(); i++) {
      node = (MoralGraphNode) nodes.get(i);
      dom = domSize(node) / node.getBruseNode().getStates().size();

      if ((dom < minDom) && (dom > 0)) {
        minDom = dom;
        bestNode = node;
      }
    }

    return bestNode;
  }