Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAdded implementation of the Max flow algorithm (Dinic) and Topological sorting #453
Conversation
of course |
Good Work! I have some suggestions. |
{ | ||
private int V,level[]; | ||
private ArrayList<Edge> adj[]; | ||
class Edge |
christianbender
Jul 21, 2018
Collaborator
In latest version of Java (java 8) you don't need inner classes. You can write this sperated in one single file like:
// one file
class A {
}
class B {
}
// ...
In latest version of Java (java 8) you don't need inner classes. You can write this sperated in one single file like:
// one file
class A {
}
class B {
}
// ...
g.addEdge(4, 3, 7 ); | ||
g.addEdge(4, 5, 4); | ||
System.out.println( "Maximum flow is: "+g.DinicMaxflow(0, 5)); | ||
} |
christianbender
Jul 21, 2018
Collaborator
If I compile this I get:
Note: MaxFlowDinic.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
You must use type specifies <TYPE>
by each collection.
If I compile this I get:
Note: MaxFlowDinic.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
You must use type specifies <TYPE>
by each collection.
* @param s=Source vertex | ||
* @param t=Sink Vertex | ||
*/ | ||
private boolean BFS(int s,int t) |
christianbender
Jul 21, 2018
Collaborator
Please use java naming conventions (camelCase)
Please use java naming conventions (camelCase)
*/ | ||
void addEdge(int u, int v, double C) | ||
{ | ||
Edge a=new Edge(v, 0, C, adj[v].size());// Forward edge : 0 flow and C capacity |
christianbender
Jul 21, 2018
Collaborator
Please put in spaces between the operators like =
Please put in spaces between the operators like =
public static void main(String args[]) | ||
{ | ||
MaxFlowDinic obj=new MaxFlowDinic(0);//Dummy object to access the non-static methods | ||
obj.go(); |
christianbender
Jul 21, 2018
Collaborator
Put in the expecting output.
Put in the expecting output.
double DinicMaxflow(int s, int t) | ||
{ | ||
// Corner case | ||
if (s == t) |
christianbender
Jul 21, 2018
Collaborator
Use curly braces.
Use curly braces.
g.addEdge(4, 1); | ||
g.addEdge(2, 3); | ||
g.addEdge(3, 1); | ||
g.topologicalSort(); |
christianbender
Jul 21, 2018
Collaborator
Add comments for the expected output.
Add comments for the expected output.
g.addEdge(3, 1); | ||
g.topologicalSort(); | ||
} | ||
} |
christianbender
Jul 21, 2018
Collaborator
Same warning as above.
Note: TopologicalSort.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Same warning as above.
Note: TopologicalSort.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
private void topologicalSortUtil(int v, boolean visited[], Stack stack) | ||
{ | ||
visited[v] = true;// Marking the current node as visited. | ||
Integer i; |
christianbender
Jul 21, 2018
Collaborator
Write instead int i = 0;
Write instead int i = 0;
visited[i] = true; | ||
recStack[i] = true; | ||
List<Integer> children = adj[i]; | ||
for (Integer c: children) |
christianbender
Jul 21, 2018
Collaborator
Write int c
Write int c
@PalAditya Can you please do the changes requested? Otherwise you can close this PR and open a fresh one with changes implemented later |
Certainly!
I am really sorry that I had been absent from GitHub the past month due to
some personal matters and I kinda forgot about this one. I'll be
implementing them within a couple of days :)
…On Fri, Aug 3, 2018, 3:26 AM Varun Upadhyay ***@***.***> wrote:
@PalAditya <https://github.com/PalAditya> Can you please do the changes
requested? Otherwise you can close this PR and open a fresh one with
changes implemented later
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#453 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AYV1lG5x8O8UpdJ-BpJe3fYc7gdo20-0ks5uM3WVgaJpZM4UgZ7U>
.
|
Made the requested changes |
hello everyone ....hope all of u are fine ...i just want to get the source code of modified throttled algorithm for load balancing algorithm in cloud computing |
Thanks for merging my first PR. I would like to keep contributing, if that's okay? :)
Please tel me about any mistakes though.