Class NodeIndexer<NodeType extends Node>

java.lang.Object
es.upm.fi.cig.multictbnc.nodes.NodeIndexer<NodeType>
Type Parameters:
NodeType - type of nodes that are indexed, e.g., nodes with conditional probability tables (CPTNode) or conditional intensity matrices (@code CIMNode)

public class NodeIndexer<NodeType extends Node> extends Object
Links nodes with a unique index. Each model should have its indexer since each model will use different nodes. The index starts from zero, and its maximum value is equal to the number of variables. This is necessary for the adjacency matrices, so the same rows and columns are used to refer to a certain node.
  • Constructor Details

    • NodeIndexer

      public NodeIndexer(List<NodeType> nodes)
      Constructs a NodeIndexer.
      Parameters:
      nodes - nodes to index
  • Method Details

    • getIndexNodeByName

      public int getIndexNodeByName(String nameNode)
      Returns the index of a node whose name is provided.
      Parameters:
      nameNode - node name
      Returns:
      node index
    • getIndexNodes

      public List<Integer> getIndexNodes()
      Returns the indexes of all the nodes.
      Returns:
      indexes of all the nodes
    • getNodeByIndex

      public NodeType getNodeByIndex(int idxNode)
      Returns the name of a node whose index is provided.
      Parameters:
      idxNode - node index
      Returns:
      node name