Module es.upm.fi.cig.multictbnc
Package es.upm.fi.cig.multictbnc.nodes
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)
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
getIndexNodeByName
(String nameNode) Returns the index of a node whose name is provided.Returns the indexes of all the nodes.getNodeByIndex
(int idxNode) Returns the name of a node whose index is provided.
-
Constructor Details
-
NodeIndexer
Constructs aNodeIndexer
.- Parameters:
nodes
- nodes to index
-
-
Method Details
-
getIndexNodeByName
Returns the index of a node whose name is provided.- Parameters:
nameNode
- node name- Returns:
- node index
-
getIndexNodes
Returns the indexes of all the nodes.- Returns:
- indexes of all the nodes
-
getNodeByIndex
Returns the name of a node whose index is provided.- Parameters:
idxNode
- node index- Returns:
- node name
-