Question: this is for cs 2130 help computational structures. // Project #4 test program public class P4Test { public static void main(String[] args) { // Boolean

this is for cs 2130 help computational structures.

this is for cs 2130 help computational structures. // Project #4 test

// Project #4 test program

public class P4Test

{

public static void main(String[] args)

{

// Boolean matrix definitions

int A[][] = new int[][]

{{1, 1, 0, 0, 1},

{1, 0, 1, 0, 0},

{0, 0, 0, 0, 0},

{1, 0, 0, 0, 0},

{0, 0, 1, 0, 1}};

int B[][] = new int[][]

{{0, 1, 0, 0, 1},

{0, 1, 1, 0, 0},

{1, 0, 1, 0, 0},

{1, 0, 0, 0, 0},

{0, 1, 0, 0, 1}};

int C[][] = new int[][]

{{0, 1, 0, 0, 0},

{0, 0, 1, 0, 0},

{0, 0, 0, 1, 0},

{1, 0, 0, 0, 1},

{0, 1, 0, 0, 0}};

int D[][] = new int[][]

{{1, 1, 0, 0, 0, 0},

{1, 1, 1, 0, 0, 0},

{0, 1, 1, 1, 0, 0},

{0, 0, 1, 1, 0, 0},

{0, 0, 0, 0, 0, 1},

{0, 0, 0, 0, 1, 1}};

int E[][] = new int[][]

{{0, 1, 1, 0, 0, 1},

{0, 1, 1, 0, 0, 1},

{0, 0, 1, 0, 0, 1},

{0, 0, 0, 0, 1, 1},

{0, 0, 0, 1, 1, 1},

{0, 0, 0, 0, 0, 0}};

int F[][] = new int[][]

{{0, 0, 0, 0, 1, 0, 1, 0, 0},

{1, 0, 0, 1, 0, 0, 0, 0, 0},

{0, 0, 0, 0, 0, 0, 0, 0, 0},

{0, 0, 1, 0, 0, 0, 0, 1, 1},

{0, 0, 0, 0, 0, 0, 0, 0, 0},

{0, 1, 0, 0, 0, 0, 0, 0, 0},

{0, 0, 0, 0, 0, 0, 0, 0, 0},

{0, 0, 0, 0, 0, 0, 0, 0, 0},

{0, 0, 0, 0, 0, 0, 0, 0, 0}};

int G[][] = new int[][]

{{0, 0, 0, 1, 0, 0, 0, 0, 0},

{0, 0, 0, 0, 0, 0, 0, 0, 0},

{1, 0, 0, 0, 0, 0, 0, 0, 0},

{0, 0, 1, 0, 0, 1, 0, 0, 0},

{0, 1, 0, 0, 0, 0, 1, 0, 1},

{0, 0, 0, 0, 0, 0, 0, 1, 0},

{0, 0, 0, 0, 0, 0, 0, 0, 0},

{0, 0, 0, 0, 0, 0, 0, 0, 0},

{0, 0, 0, 0, 0, 0, 0, 0, 0}};

BMat BMA = new BMat(A);

// Put code here...

} // end main

} // end class

*********************************

// SampleTest1 - sample program to test BMat class

public class SampleTest1

{

public static void main(String[] args)

{

int[][] C = new int[][]

{{0, 0, 0},

{1, 1, 0},

{1, 1, 0}};

int[][] D = new int[][]

{{1, 1, 0},

{0, 1, 0},

{0, 1, 1}};

// Instance and display initial objects

BMat MC = new BMat(C);

BMat MD = new BMat(D);

System.out.println(" Matrix C");

MC.show();

System.out.println(" Matrix D");

MD.show();

// Declare work objects

BMat W1, W2, W3;

// Indegree of node 1 of D

// Node numbers are 0, 1, 2

int indegreeD1 = MD.indegree(1);

System.out.println(" Indegree of node 1 of D = " + indegreeD1);

// Complement of C

W1 = MC.complement();

System.out.println(" Complement of C");

W1.show();

// Join (OR) of C and D

W2 = MC.join(MD);

System.out.println(" Join of C and D");

W2.show();

// Reflexive Closure of C

W3 = MC.rclosure();

System.out.println(" Reflexive Closure of C");

W3.show();

}

} // end class

Write a test program that uses BMat objects to do specified Boolean matrix calculations. The starting version of your program should be the sample file P4Test.java. Instance BMat objects for the matrices A, B, C, D, E, F, and G that are defined in P4Test Using BMat methods, have your program calculate the following (X is an integer variable, and Wis a work matrix): (Mcomplement of M) W=OD" VOD" VOD" VOD X = maximum out-degree f all nodes in D W symmetric closure of D. Is D symetric ? W transitive ci sure f E. 13 E transitive? e. f. i.Show that matrix F represents a tree (has a candidate root node and has no cycles) j. Show that matrix G does not represent a tree

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!