Skip to content

Commit

Permalink
Corrected Typo in variable name
Browse files Browse the repository at this point in the history
  • Loading branch information
taran-1407 authored Oct 1, 2020
1 parent 7cf55d7 commit 5d5042d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions GraphBuilder/GraphBuilder.java
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
class GraphBuilder{
public static int[][] makeGraph(int NumberOfNoes, int NumberOfEdges, int[] from, int[] to, boolean undirected){
int[][] graph = new int[NumberOfNoes][];
int[] outdegree = new int[NumberOfNoes];
public static int[][] makeGraph(int NumberOfNodes, int NumberOfEdges, int[] from, int[] to, boolean undirected){
int[][] graph = new int[NumberOfNodes][];
int[] outdegree = new int[NumberOfNodes];
for(int i = 0; i< NumberOfEdges; i++){
outdegree[from[i]]++;
if(undirected)outdegree[to[i]]++;
}
for(int i = 0; i< NumberOfNoes; i++)graph[i] = new int[outdegree[i]];
for(int i = 0; i< NumberOfNodes; i++)graph[i] = new int[outdegree[i]];
for(int i = 0; i< NumberOfEdges; i++){
graph[from[i]][--outdegree[from[i]]] = to[i];
if(undirected)graph[to[i]][--outdegree[to[i]]] = from[i];
}
return graph;
}

public static int[][][] makeGraphWithEdgeInfo(int NumberOfNoes, int NumberOfEdges, int[] from, int[] to, boolean undirected){
int[][][] graph = new int[NumberOfNoes][][];
int[] outdegree = new int[NumberOfNoes];
public static int[][][] makeGraphWithEdgeInfo(int NumberOfNodes, int NumberOfEdges, int[] from, int[] to, boolean undirected){
int[][][] graph = new int[NumberOfNodes][][];
int[] outdegree = new int[NumberOfNodes];
for(int i = 0; i< NumberOfEdges; i++){
outdegree[from[i]]++;
if(undirected)outdegree[to[i]]++;
}
for(int i = 0; i< NumberOfNoes; i++)graph[i] = new int[outdegree[i]][];
for(int i = 0; i< NumberOfNodes; i++)graph[i] = new int[outdegree[i]][];
for(int i = 0; i< NumberOfEdges; i++){
graph[from[i]][--outdegree[from[i]]] = new int[]{to[i], i, 0};
if(undirected)graph[to[i]][--outdegree[to[i]]] = new int[]{from[i], i, 1};
Expand Down

0 comments on commit 5d5042d

Please sign in to comment.