write a C/C++/Java/Python program to implement Kernighan-Lin's bi- partitioning algorithm. The objective is to minimize the...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
write a C/C++/Java/Python program to implement Kernighan-Lin's bi- partitioning algorithm. The objective is to minimize the number of edges in the cut. Input: A text file describing a set of even number of nodes and a set of edges. If there are n nodes, the node indices are continuous integers from 1 to n. Input file format: • The first line has two numbers- the number of nodes followed by the number of edges. • Each of the following lines has two numbers that are indices of two nodes of an edge. For example: 32 12 23 Requirement: • The initial solution must be partition (1, 2) and +1, +2. n). • • The input filename should be taken as the argument at command line in Linux/UNIX. Please submit source code, which includes at most one .c file and at most one.h file, and the executable code that can run on an ECE server (Linux/UNIX). Please avoid using file compression, which may corrupt files. • Please name your files by your last name followed by the last 4 digits of your UIN. For example, if your last name is Rao and your UIN is 7070567, your executable filename should be ra00567 and the source code files are rao0567.c and rao0567.h. • The output should be displayed to screen in a self-clear format. Output: • Two partitions, each of which is described by the indices of its member nodes. • Cut set, represented by the edges in the cut, an edge is denoted by a pair of node indices. Grading: Your executable code will be evaluated by certain testcases on an ECE server. The grading will consider your program speed besides the solution correctness and completeness. write a C/C++/Java/Python program to implement Kernighan-Lin's bi- partitioning algorithm. The objective is to minimize the number of edges in the cut. Input: A text file describing a set of even number of nodes and a set of edges. If there are n nodes, the node indices are continuous integers from 1 to n. Input file format: • The first line has two numbers- the number of nodes followed by the number of edges. • Each of the following lines has two numbers that are indices of two nodes of an edge. For example: 32 12 23 Requirement: • The initial solution must be partition (1, 2) and +1, +2. n). • • The input filename should be taken as the argument at command line in Linux/UNIX. Please submit source code, which includes at most one .c file and at most one.h file, and the executable code that can run on an ECE server (Linux/UNIX). Please avoid using file compression, which may corrupt files. • Please name your files by your last name followed by the last 4 digits of your UIN. For example, if your last name is Rao and your UIN is 7070567, your executable filename should be ra00567 and the source code files are rao0567.c and rao0567.h. • The output should be displayed to screen in a self-clear format. Output: • Two partitions, each of which is described by the indices of its member nodes. • Cut set, represented by the edges in the cut, an edge is denoted by a pair of node indices. Grading: Your executable code will be evaluated by certain testcases on an ECE server. The grading will consider your program speed besides the solution correctness and completeness.
Expert Answer:
Answer rating: 100% (QA)
Below is an example implementation of KernighanLins bipartitioning algorithm in Python Save this code in a file named rao0567py Make sure to replace r... View the full answer
Related Book For
Introduction to Algorithms
ISBN: 978-0262033848
3rd edition
Authors: Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest
Posted Date:
Students also viewed these programming questions
-
This assignment reviews object-oriented programming concepts such as classes, methods, constructors, accessor methods, and access modifiers. It makes use of an array of objects as a class data...
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-5. Ivan's grandfather died and left a portfolio of municipal bonds. In 2012, they pay Ivan...
-
A school district comprises 24 schools. The numbers of students in each of the schools are as follows: The district wants to implement an experimental teaching and learning model for approximately...
-
In Exercise 3-70, recall that a particularly long traffic light on your morning commute is green 20% of the time that you approach it. Assume that each morning represents an independent trial. (a)...
-
The diagram shows an equilateral triangle, PQR, with side length 5cm. M is the midpoint of the line QR. An arc of a circle, centre P, touches QR at M and meets PQ at X and PR at Y. Find in terms of ...
-
Show that your blood supply can carry as many as 3 10 22 molecules of oxygen. Heres some information you may find useful: You have 25 trillion red blood cells. Each red blood cell contains 300...
-
Refer to the data for University Printers in Exercise 11-24. Required Allocate the service department costs using the step method, starting with the Maintenance Department. What effect does using...
-
Identify the effects of the following transactions in the table below: Balance Sheet Income Statement Cash Transaction + Asset Noncash Assets Contrib. Earned Net Liabilities + + - Revenues Expenses =...
-
First Choice Company uses the FIFO cost formula in a perpetual inventory system. Fill in the missing amounts for items (a) through (k) in the following perpetual inventory record: Inventory Balance...
-
describes betty\'s emotional, mental, moral and physical transformation, if any, in these episodes in no less than 250 words. If you were the producer, what would you have done differently with this...
-
Apply Riemann integrals to physics: Find the location of the CM of a right cone of radius R and height H. (b) Intersect the right cone by a horizontal plane. The part of the cone below the plane is...
-
Let Market Supply for apartments be P=$200+0.5Qs Let Market Demand for apartments be P=$1700-0.75Qd a.) Calculate the amount of Producer Surplus gained if rent control occurred, and the new price was...
-
The graph shows the speed of a car as a function of time. 7 v (m/s) 16 15 14 13 12 11 10 9 7 6 5 4 3 2 1 0 1 2 3 4 5 t(s) Initially the car is at rest. What is the acceleration of the car? Please,...
-
(a) A physics lab instructor is working on a new demonstration. She attaches two identical copper globes with mass m = 0.190 g to strings of length L as shown in the figure. L A m m Both globes have...
-
Enter the following quantities into a spreadsheet. Column 1 Column 2 Y X 2 2 4 6 8 2.83 3.46 4 Column 3 X^2 Complete the missing column and graph columns 1 vs 3. Use a trendline and display the...
-
What does the sentence "No part of the net income of which inures to the benefit of any private individual" mean? P.S. This is for the deductions of Gross Income
-
What is the maximum volume of 0.25 M sodium hypochlorite solution (NaOCl, laundry bleach) that can be prepared by dilution of 1.00 L of 0.80 M NaOCl?
-
Let M (n) be the time to multiply two n n matrices, and let S (n) denote the time required to square an n n matrix. Show that multiplying and squaring matrices have essentially the same difficulty:...
-
Suppose that we have an array of n data records to sort and that the key of each record has the value 0 or 1. An algorithm for sorting such a set of records might possess some subset of the following...
-
Modify the APPROX-SUBSET-SUM procedure to also return the subset of S that sums to the value z * .
-
What is the formula to calculate an individuals taxable income?
-
Describe the goal of tax planning.
-
Differentiate between tax compliance and tax planning.
Study smarter with the SolutionInn App