1. Homepage
  2. Programming
  3. COMPSCI 320 - Applied Algorithmics - Assignment 1: Graph Algorithms

COMPSCI 320 - Applied Algorithmics - Assignment 1: Graph Algorithms

Engage in a Conversation
澳洲AustraliaUniversity of AucklandCOMPSCI 320Applied AlgorithmicsGraph AlgorithmsMinimum Spanning TreesCC++JavaPython

Computer Science 320S2C (2022) CourseNana.COM

Assignment 1 (Graph Algorithms) Due date August 1, 2022, 11.59pm CourseNana.COM

Introduction CourseNana.COM

This warm-up assignment tests your pre-requisite skills from CS220 on graph optimization problems. You need to submit two programs for the following tasks to https://www.automarker.cs.auckland.ac.nz/ to get marks for this assignment. Most common programming languages will be available to do the assignment. Note this marker runs on a linux box so no Microsoft specific code should be used; read the help/FAQ for more details. Input is from keyboard/stdin and output is to console/stdout. CourseNana.COM

Task 1 is worth 2 marks and you can implement any standard solution. Tasks 2 is worth 3 marks, where some algorithm design thinking is required. Both problems will contain easy and harder input cases on the automarker. CourseNana.COM

An excessive number of submissions (over 10) for a particular problem will accrue a 20% penalty per that problem if you eventually solve it. CourseNana.COM

Task 1: Minimum Spanning Trees CourseNana.COM

For this warm-up task you are to implement any efficient minimum spanning tree algorithm that takes a sequence of edge-weighted graphs and outputs the minimum cost weight of a spanning tree of each. CourseNana.COM

Input Format CourseNana.COM

For this assignment we use adjacency matrices with positive integer weights. Here a zero entry at row i and column j indicates that no edge ij exists in the graph. The first line consists of an integer n 1000 denoting the order of the graph. This is then followed by n lines of n white-space separated integers denoting edge weights. The sequence of graphs is terminated by a value n = 0, which is not processed. CourseNana.COM

3
013
102
320
4
0270 2051 7503 0130
6 010400 103030 030002 400020 030201 002010 0
CourseNana.COM

Output Format CourseNana.COM

Output should be one line for each input graph indicating the minimum cost weighted tree. The sample output for the previous input cases is as follows. CourseNana.COM

3 6 9 CourseNana.COM

Task 2: Snakes in a Graph CourseNana.COM

For a graph G = (V,E), a snake (also called an induced path) is a path v1,v2,...,vk such that for all j i > 1 (vi,vj) ̸∈ E. That is, it is a sequence of vertices in G such that each two adjacent vertices in the sequence are connected by an edge in G, and each two nonadjacent vertices in the sequence are not connected by any edge in G. CourseNana.COM

For this task, our goal is to determine the longest snake of a graph. CourseNana.COM

Input Format CourseNana.COM

Input for this problem consist of a sequence of one or more (undirected) graphs taken from the keyboard. Each graph is represented by an adjacency list. The first line is an integer n indicating the order of the graph. This is followed by n white space separated lists of adjacencies for nodes labeled 0 to n 1. The input will be terminated by a line consisting of one zero (0). This line should not be processed. Two sample input graphs are listed below. The easy (harder) test cases are graphs of order at most 10 (50). CourseNana.COM

4
1 03
CourseNana.COM

1
5
14 02 134 24 023 0
CourseNana.COM

Output Format CourseNana.COM

Output will be just one integer per line. For the above, input we would output the following two integers denoting the longest snake of the two graphs. Recall that the length of a path is the number of edges. CourseNana.COM

2 3  CourseNana.COM

Get in Touch with Our Experts

WeChat (微信) WeChat (微信)
Whatsapp WhatsApp
澳洲代写,Australia代写,University of Auckland代写,COMPSCI 320代写,Applied Algorithmics代写,Graph Algorithms代写,Minimum Spanning Trees代写,C代写,C++代写,Java代写,Python代写,澳洲代编,Australia代编,University of Auckland代编,COMPSCI 320代编,Applied Algorithmics代编,Graph Algorithms代编,Minimum Spanning Trees代编,C代编,C++代编,Java代编,Python代编,澳洲代考,Australia代考,University of Auckland代考,COMPSCI 320代考,Applied Algorithmics代考,Graph Algorithms代考,Minimum Spanning Trees代考,C代考,C++代考,Java代考,Python代考,澳洲help,Australiahelp,University of Aucklandhelp,COMPSCI 320help,Applied Algorithmicshelp,Graph Algorithmshelp,Minimum Spanning Treeshelp,Chelp,C++help,Javahelp,Pythonhelp,澳洲作业代写,Australia作业代写,University of Auckland作业代写,COMPSCI 320作业代写,Applied Algorithmics作业代写,Graph Algorithms作业代写,Minimum Spanning Trees作业代写,C作业代写,C++作业代写,Java作业代写,Python作业代写,澳洲编程代写,Australia编程代写,University of Auckland编程代写,COMPSCI 320编程代写,Applied Algorithmics编程代写,Graph Algorithms编程代写,Minimum Spanning Trees编程代写,C编程代写,C++编程代写,Java编程代写,Python编程代写,澳洲programming help,Australiaprogramming help,University of Aucklandprogramming help,COMPSCI 320programming help,Applied Algorithmicsprogramming help,Graph Algorithmsprogramming help,Minimum Spanning Treesprogramming help,Cprogramming help,C++programming help,Javaprogramming help,Pythonprogramming help,澳洲assignment help,Australiaassignment help,University of Aucklandassignment help,COMPSCI 320assignment help,Applied Algorithmicsassignment help,Graph Algorithmsassignment help,Minimum Spanning Treesassignment help,Cassignment help,C++assignment help,Javaassignment help,Pythonassignment help,澳洲solution,Australiasolution,University of Aucklandsolution,COMPSCI 320solution,Applied Algorithmicssolution,Graph Algorithmssolution,Minimum Spanning Treessolution,Csolution,C++solution,Javasolution,Pythonsolution,