Академический Документы
Профессиональный Документы
Культура Документы
List the edges in the space below. The order of the edges doesn't matter, but the order of the vertices in each edge
does matter, since this graph is directed.
Question 2: Given the following directed graph, how would you represent it with an adjacency matrix?
Fill out this matrix of 0s and 1s, where the entry in row i and column j is 1 if and only if the edge (i,j) is in the
graph. Since this is a directed graph, the matrix will not necessarily be symmetric.
Question 3: Given the following directed graph, how would you represent it with an adjacency list?
Question 4: Consider the following graph,
import java.util.Arrays;
class Solution {
public static int[][] edgeList = new int[][] {
new int[] {0, 2},
new int[] {1, 3},
new int[] {2, 3},
new int[] {2, 4},
new int[] {3, 5},
new int[] {4, 5}
};
}
Part 2: Store an adjacency list
import java.util.Arrays;
class Solution {
public static int[][] edgeList = new int[][] {
new int[] {0, 2},
new int[] {1, 3},
new int[] {2, 3},
new int[] {2, 4},
new int[] {3, 5},
new int[] {4, 5}
};