➕︎ Aa ➖︎ |Dark 1 ● Dark 2 ● Light|Hack ● Fira Code|Back to PT Mono✖
// CPCS 324 Algorithms & Data Structures 2
// Reference starter - Basic Flow Network Package
// 2019, Dr. Muhammad Al-Hashimi
// -----------------------------------------------------------------------
// a maximum flow implementation based on simple graph object with
// minimal linked-list edge implementation and fields
//
var _v = [], _e = []; // note naming conventions in upload guide
// -----------------------------------------------------------------------
function _main()
{
}
// -----------------------------------------------------------------------
// network object initial requirements: support Edmonds-Karp maximum flow algorithm
function FNetwork()
{
// --------------------
// student property fields next
// --------------------
// student member methods next
// note following are required method names, you are not required to use all of them
// but must use the name if you choose to have the method
// accessor methods: getters
this.edgeFlow // return (get) flow for argument edge i,j
this.edgeCap // return capacity for argument edge i,j
this.srcVertex // return source vertex (or its id, you decide)
this.sinkVertex // return sink vertex (or its id, you decide)
this.getFlowVal // return current flow *value* in network
this.getFlow // return current flow as array of {u,v,flow} objects
this.inFlow // return incoming flow for argument vertex
this.outFlow // return outgoing flow for argument vertex
// accessor methods: setters
this.setEdgeFlow // set flow on argument edge (i,j)
this.setFlow // set flow to argument (including 0) for all edges
this.initFlow // reset flow to 0 for all edges
this.setLabel // set network label (hide Graph code)
// other possibly useful method names
this.isSrc // true if argument is source vertex of network
this.isSink // true if argument is sink vertex of network
this.isEdge // true if argument vertices form an edge ALERT belong to Graph() but leave as test to students
this.isBackwardEdge // true if argument vertices form a backward edge
this.readNetwork // input reader method
this.printNetwork // output network including current flow (reference output of final project
this.edmondsKarp // implement the Edmonds-Karp max flow algorithm for maximum flow, must return number of paths used to augment flow
}
// -----------------------------------------------------------------------
// similar to starter 8
function Vertex(v)
{
}
// -----------------------------------------------------------------------
// similar to starter 8
function Edge(vert_i,weight)
{
}
// -----------------------------------------------------------------------
// similar to starter 8 (REMOVE transitive closure/greedy package stuff)
function Graph()
{
}
// -----------------------------------------------------------------------
// functions used by methods of FNetwork and ancillary objects
// -----------------------------------------------------------------------
// begin student code section
// -----------------------------------------------------------------------
// flow network package (REMOVE transitive closure/greedy package stuff)
function edmondsKarpImpl()
{
}
// -----------------------------------------------------------------------
// published docs section (ref. assignment page)
// similar to starter 8 (strip line comments, leave outline)
// no JSDOC comments in this section
// -----------------------------------------------------------------------
function list_vert()
{
} // etc.