Class BayesEdge


  • public class BayesEdge
    extends Object
    Contains utilities to make changes to edges of a Bayesian Network. With this class, you can add, remove or reverse an edge between any two nodes in the Bayesian Network.
    • Constructor Detail

      • BayesEdge

        public BayesEdge()
    • Method Detail

      • main

        public static void main​(String[] args)
      • addEdge

        public int[][] addEdge​(int[][] Graph,
                               int FromNode,
                               int ToNode)
        Adds an edge between node FromNode to node ToNode. Note that the edge is directed and originates from FromNode and goes to ToNode.
        Parameters:
        int - [][] Graph - The Bayesian network graph represented as a Adjacency matrix.
        int - FromNode - An integer value specifying the originating node
        int - ToNode - An integer value specifying the target node
        Returns:
        The revised int[][] matrix representing the Graph. This is stored in a different memory location than the input int[][] Graph
      • removeEdge

        public int[][] removeEdge​(int[][] Graph,
                                  int FromNode,
                                  int ToNode)
        Removes an edge between node FromNode to node ToNode. Note that this method removes the edge which is directed and originates from FromNode and goes to ToNode. If no such directed edge exists, then the method prints out the appropriate message.
        Parameters:
        int - [][] Graph - The Bayesian network graph represented as a Adjacency matrix.
        int - FromNode - An integer value specifying the originating node
        int - ToNode - An integer value specifying the target node
        Returns:
        The revised int[][] matrix representing the Graph. This is stored in a different memory location than the input int[][] Graph
      • reverseEdge

        public int[][] reverseEdge​(int[][] Graph,
                                   int FromNode,
                                   int ToNode)
        Reverses an edge between node FromNode to node ToNode. If no such edge exists, then the appropriate message is displayed.
        Parameters:
        int - [][] Graph - The Bayesian network graph represented as a Adjacency matrix.
        int - FromNode - An integer value specifying the originating node
        int - ToNode - An integer value specifying the target node
        Returns:
        The revised int[][] matrix representing the Graph. This is stored in a different memory location than the input int[][] Graph