#Doing an Assignment for class using a given graph to find certain nodes to remove

1 messages · Page 1 of 1 (latest)

boreal temple
#

Hai!
Im having so much trouble with this course, and I don't know how to do this one bit.

I attached the instructions in the image and the starting code for making the method as well.

Help would be very much appreciated.

Basically, this is the starting code you're given:


int[][] graph = new int[8][8];
        Scanner rdr = new Scanner(new File("socials.txt"));
        ArrayList<String> follows = new ArrayList<>();
        ArrayList<String> UnfollowList = new ArrayList<>();
        while (rdr.hasNextLine()) {
            follows.add(rdr.nextLine());
        }
        for (int x = 0; x < follows.size(); x++) {
            graph[follows.get(x).charAt(0) - '0'][follows.get(x).charAt(2) - '0'] = 1;
        }
        for (int x = 0; x < friendsList.length; x++) {
            for (int y = 0; y < graph[0].length; y++) {
                if (graph[0][y] == 1 && graph[getNode(friendsList[x])][y] == 1)
                    UnfollowList.add(graphANames[y]);
            }
        }
        return UnfollowList;
 `JAVA

int[][] graph = new int[8][8];
        Scanner rdr = new Scanner(new File("socials.txt"));
        ArrayList<String> follows = new ArrayList<>();
        ArrayList<String> UnfollowList = new ArrayList<>();
        while (rdr.hasNextLine()) {
            follows.add(rdr.nextLine());
        }
        for (int x = 0; x < follows.size(); x++) {
            graph[follows.get(x).charAt(0) - '0'][follows.get(x).charAt(2) - '0'] = 1;
        }
        for (int x = 0; x < friendsList.length; x++) {
            for (int y = 0; y < graph[0].length; y++) {
                if (graph[0][y] == 1 && graph[getNode(friendsList[x])][y] == 1)
                    UnfollowList.add(graphANames[y]);
            }
        }
        return UnfollowList;
gritty pasture
#

it looks like you're using ''' instead of ` ``

#

it should be the one on the same key as ~

#

the tilde