
Q01:
I have a quick question regarding flow, capacity and weights in regard to the random graphs we have generated. I am a little confused as to how to interpret the weights of the edges of our graphs in relation to understanding the flow and capacity used in the algorithms described in the text book.
A:
A weight of an edge (u,v) generated by a random graph generator are interpreted as
a capacity c(u,v) of the edge in the context of maximum network flow problem.
Please see p.709 of the textbook or my lecture note #13.
http://www2.hawaii.edu/~sugihara/course/ics311f10/notes/1014n13.html#S3
Does a negative weight denote a negative flow?
A:
In the textbook, it is assumed that every edge has a nonnegative capacity.
That is a common assumption, although there is a generalization of
the maximum network flow problem in which an edge can have a negative capacity.
Thus, we also assume in Implementation Assignment 3 that every capacity is nonnegative.

Q02:
I think I have a fairly decent understanding of the generic pushrelabel algorithm and how it works on acyclic graphs. But I can't figure out whether it will work on the digraphs that we developed for assignment2.
There is a case where you will have 2 edges connecting the same nodes and this confuses my understanding of
f[s,u] < c(s,u)
f[u,s] < c(s,u)
It would appear that a residual graph is already assumed by the explanation given in the text book. This residual graph definition will interfere with the application of this algorithm on the possible digraphs generated, unless we ignore cycles between two vertices. Judging by the sample graphs you provided, it would appear that cycles between 2 vertices should not exist.
A:
A good question.
However, we should "NOT ignore" a cycle of length 2 between two vertices.
It is easy to convert a digraph G with cycles of length 2 into a digraph G'
without any cycle of length 2 such that G' is equivalent to G in terms of max flow.
This issue of "antiparallel edges" is explained in pp.711712 of the textbook.
I know you've answered this question, but i just want to clarify, for our implementation, are we to assume that the source will be 1 and the sink will be "n".
A:
Yes, that's correct.
Also in the case where the source or the sink are completely separated from each other, should the max flow be 0?
A:
Yes, correct.
if possible, could you post the expected results for running the algorithms on the sample digraphs you provided? I wrote them down somewhere, but alas I cannot find my notes on it.
A:
The first sample data "digraph01.txt" is the example in Figure 26.1 (p.710)
of the textbook.
Its max flow is given in Figure 26.6 (p.727).
I chose another sample data "digraph02.txt" from another book.
OK, I will scan a diagram of the max flow for it from the book
and post the diagram in supplements later.
Note that the digraph of "digraph02.txt" includes antiparallel edges,
such as edges between v_{4} and v_{6}.

Q03:
I've managed to implement a working version of the relabel to front algorithm
A:
Good!
but I can't figure out the criteria for a generic push relabel algorithm. It would seem that if you implement it with a queue, it would have to function similarly to the FIFO relabel to front algorithm.
A:
The "generic" pushrelabel algorithm in the textbook
is not actually a "particular" algorithm.
That is a class of algorithms for the maximum network flow problem.
As the first sentence in Section 26.5 says, it allows
any way (i.e., ordering) of choosing the next operation
(either push or relabel) as long as applicable.
Do you have any ideas I should consider? Should I just try to find a way to dumb down the relabel to front algorithm? Perhaps change the order in which active nodes are processed? Should I iterate through a list of all nodes regardless of whether they are active or not?
A:
Please make a "simpleminded way" to choose one of applicable operations.

Q04:
At the end of the semester when I took ICS 211 the professor provided the students with a CD containing all of the Java source code in the text book that we used. I would like to use one of the ADT's  Directed Graph  that was included on the CD. The problem is that it also uses a number of other ADT's in its implementation such as Vertex, LinkedDictionary, LinkedList, and their respective Interfaces. Since the code was for a course, some of the essential bits have been left out but are easily solvable. Would it be ok for me to use and modify this source code for the Implementation Assignment 3 and if so, how can I cite this source since it comes from a book?
A:
I cannot answer to this question right away because
some textbooks claim their copyright on source code in the books
that limits the usage (such as modification) of the source code.
Please check the following.
 Whether source code includes the copyright header of
the textbook's author(s) or publisher.
Please check whether the author explicitly states to prohibit
copy and/or modification of the source code.
Because the instructor of ICS211 have distributed CD copies of
source code, it seems copy is allowed (but modification is still
in question).
 Whether the author(s) states any restriction(s) on source code in the textbook
(probably, in Preface).
If the source code doesn't include any copyright clause, it's likely
the code is in public domain and hence it can be reused in any way.
In this case, please write the name(s) of the author(s) together with
the textbook's title and publisher as the origin of the source code
in a header of the reused source code.

Q05:
I have a question in regard to the information to be displayed corresponding to the maximum flows. Since each algorithm may process the maximum flow differently, their flow graphs may be subtly different  although they will still have the same maximum flow.
A:
Yes, different max flow algorithms may produce different max flows
with the same total value of flows.
Are we supposed to display the flow graph result of each algorithm in the maximum flow text area?
A:
Yes.
If three algorithms run for each digraph,
there are three consecutive blocks of maximum flow representation.
4 5
1 2 10 7
1 3 4 2
2 3 1 1
2 4 6 6
3 4 3 3
##########
4 5
1 2 10 6
1 3 4 3
2 3 1 0
2 4 6 6
3 4 3 3
##########
4 5
1 2 10 6.3
1 3 4 2.7
2 3 1 0.3
2 4 6 6
3 4 3 3
##########
If you want to clarify which block was produced by each algorithm,
you may append an algorithm's identifier (e.g., serial number or
the name of the algorithm) to the ten #'s.
In addition, you may also append the total value of max flows
in order to ease confirming a correct implementation of each algorithm.
4 5
1 2 10 7
1 3 4 2
2 3 1 1
2 4 6 6
3 4 3 3
########## Generic PushRelabel max flow = 9
4 5
1 2 10 6
1 3 4 3
2 3 1 0
2 4 6 6
3 4 3 3
########## RelabeltoFront max flow = 9
4 5
1 2 10 7
1 3 4 2
2 3 1 1
2 4 6 6
3 4 3 3
########## EdmondsKarp max flow = 9
It would appear that as long as the vertices along with their corresponding neighbors are processed in the same methodical order, the would have the same flow graph (but this is just an intuitive assumption and may not be correct).
A:
As long as an algorithm is deterministic (i.e., not randomized),
it produces the same output in every execution for the same input.
For the same weighted digraph, different algorithms for the maximum network flow problem
may or may not produce the same solution
because there may be multiple optimum solutions to the maximum network flow in general.
Also, should we display each flow graph K number of times? Or would just 1 time suffice?
A:
Because we consider only deterministic algorithms,
an output of every execution is identical for the same input.
We repeat to execute an algorithm for each digraph
simply because we need to observe the average execution time.
Thus, display only one output for each pair of an input digraph
and an algorithm irrespective of the repetition number K.

Q06:
I'm just about done with programming aspect of implementation assignment3 but have a question regarding the mean and variance labels on the chart. In the case of user defined set of graphs from a text file, are we supposed to calculate the mean and variance of these graphs that were inputted?
A:
Yes, an applet needs to compute μ and σ^{2} from
an input sequence of digraphs.
What would happen in the case where there is only 1 graph defined in the text file?
A:
In case of a single digraph G, μ is the density of G and σ^{2} is 0.

Q07:
In your specification for the output of implementation assignment 3, you want a textual representation of each graph's maximum flow displayed in a text area with each edge's weights representing the flow of the edge. Should we include edges that have no flow (i.e. flow 0) in this printout, or omit them?
A:
All edges must be included in the textual representation.
If there is no flow along an edge, the value 0 should be written
at the 4th position (following a weight at the 3rd position)
on a line for the edge.

Q08:
For this assignment, since we are comparing execution times for all of our algorithms, should we be trying to write our implementations to execute as quickly as possible?
A:
Of course, it is desirable to implement a max flow algorithm
in such a way that its execution becomes as fast as possible.
However, in this assignment, that is not a primary objective.
The primary objectives are the following.
 To implement max flow algorithm "accurately":
Thus, you should make it sure that every max flow algorithm
in your applet produces optimum solutions to the sample digraphs
digraph01.txt and digraph02.txt posted in
Sample Data.
The objective function value of the maximum flows to both
sample input data is 23.
 To observe differences among actual running times of
different max flow algorithms:
The asymptotic order of magnitude in the theoretical analysis
does not necessarily represent the actual efficiency.
It is important to recognize such a discrepancy in theory vs practice.
In previous assignments we were graded on 'programming skills', I was wondering how skill has been graded.
A:
Jade evaluates a programming skill level of a student "qualitatively".
I don't know exactly what her evaluation criterion of this skill level.
I guess that she reviews source code and decides how well source code is written
based on her programming experience.
A simple example:
I could leave all my Node objects' variables as public for faster execution (no get/set methods) to increase execution time, but would this make my programming skills grade suffer?
A:
I am not the right person to answer this particular question though,
I guess it will not reduce your score for programming skills,
especially if you comment the above reason (leaving as public for
faster execution) in your source code.
It may be a good idea to create a section named "Implementation Details"
in a reference manual and write such an issue in the section in order to
explain a good reason why you coded in that way.

Q09:
It would appear that the Edmond Karp Max flow algorithm does not work with antiparallel edges according to
http://www.cs.unh.edu/~ruml/cs758/slides/slides18.pdf;
at least this seems implied from this pdf.
With the antiparallel edge breaking technique (pp.711712 of the textbook)
you explained to me, I was able to generate the correct output on
digraph02.txt. I just thought you might find that interesting.
However, the GPR and RF algorithms both work on graphs with anti parallel edges.
A:
Thank you for informing us that some algorithms work on digraphs with antiparallel edges
without converting the antiparallel edges in the way described in pp.711712.
Also, it would appear that the Edmond Karp algorithm is much faster than the GPR and RF algorithms according to my graph results. This is quite surprising to say the least. Please let me know what you think about this situation. I have included a sample graph for your inspection. From these results, it would seem that EK has the most practical value in terms of application.
A:
For relatively small input sizes n (such as n = 20),
your statement based on experimental results may be correct.
But, observations on only n = 20 are too particular to conclude
a general statement.
You should conduct experiments on a wide spectrum of n.
That's why I require "Data for each of n = 10, 20, 30, 50, 70, 100,
150, 200, 300, 500, 700 and 1000" in the
optional assignment.
Even n = 1000 is not that large in practice.
Perhaps, you need to try a few digits larger than 1000, like n = 10^{6}
(but, you may not be able to execute an algorithm for a high density
due to a memory limitation on a Web browser).
A similar situation sometimes happens.
For example, the insertion sort of Θ(n^{2}) may be
faster than the heapsort of Θ(n lg n) for n < 10.
Because a "simple" algorithm of a bigger order usually has a smaller
constant coefficient of its actual running time and
a "sophisticated" algorithm of a smaller order
usually has a larger constant coefficient of its actual running time.