Dependency Graph

c# question and need guidance to help me learn.

Everything in the file
Requirements:
1/27/23, 11:19 AMAssignment Two – Dependency Graphhttps://utah.instructure.com/courses/834041/assignments/11982609?return_to=https%3A%2F%2Futah.instructure.com%2Fcalendar%23view_name%3Dmonth%26…1/15Assignment Two – Dependency GraphDue Friday by 11:59pm Points 100 1. Assignment Two – Dependency GraphYour second assignment continues the trek toward building a spreadsheet. The first assignment createda formula evaluator which is used at the base level to compute math expressions. The question youmight ask, is:”Where in a spreadsheet do variables come from?”.The answer is of course: other cells. In an easy case, there are no variables, e.g., cell A1 contains theformula 5+5. More interestingly, A1 could contain the formula A2+A3. But wait! A2 could containthe formula A3*A4. Thus, the problem your program has to solve is:”Which cells have to be computed first?” or said another way “What is the ordering of computationacross all the cells?”. In this example, it should be obvious that A3 and A4 have to be computed before A2, and A2 before A1. The purpose of this assignment is to build the infrastructure to handle these dependencies. As always, Read The Entire Assignment page before starting the project. Then come back to the startand re-read it!2. Learning OutcomesAs always, the purpose of this assignment is not to create code that we will sell to Google or Microsoft toreplace the core engine in Google Sheets or Excel. The purpose of this assignment is to help youdevelop your software practice skills and techniques, and to become a better programmer who iscapable of meeting requirements (and solving problems) using the best tools for the job.At the end of this assignment you should be able to:Define what a dependency graph is and create code to effectively implement one. This includesdetermining the best data structures to use.Take a pre-determined API and generate code to match this specification (as well as describe whatan API is and how it makes coding projects better)Use (and explain) examples of good software engineering practices
1/27/23, 11:19 AMAssignment Two – Dependency Graphhttps://utah.instructure.com/courses/834041/assignments/11982609?return_to=https%3A%2F%2Futah.instructure.com%2Fcalendar%23view_name%3Dmonth%26…2/15Use Testing to drive and improve development. Define and implement unit tests.3. Lab 3 – Unit TestingInformational: Lab 3 will cover unit testing and code coverage in C#/Visual Studio. The documentationbelow will give you a quick start, but you will learn more during Lab. You are encouraged to bringquestions to the Lab as well.Further, Lab 3 will introduce you to the tools necessary to determine how much of your code is “covered”by tests.4. Overview – Dependency Graph At this point in your career, you should be familiar with the idea behind a graph. A graph representsnodes and edges between the nodes. For the purpose of an example, we will use the followingspreadsheet:A1 contains the formula: A2 + A3A2 contains the formula: A3 * A4A3 contains either a value or a formula with no variables in itA4 contains either a value or a formula with no variables in it This “state” can be represented as a graph:
1/27/23, 11:19 AMAssignment Two – Dependency Graphhttps://utah.instructure.com/courses/834041/assignments/11982609?return_to=https%3A%2F%2Futah.instructure.com%2Fcalendar%23view_name%3Dmonth%26…3/15Here a box represents a (non-empty) cell in the spreadsheet and an arrow represents therelationship: must be computed before, i.e., A4 must be computed before A2. (Note: as in ourprogram, the relationship between A4 and A1 is implied, but not directly represented!) It should be noted that while the above picture correctly identifies the relationships, I find that I like tothink/visualize in terms of “top down” (i.e., do the stuff at the top, and work your way down the diagram). Thus we can rearrange the graph (without any changes to meaning) as follows, with a “top-down”hierarchy imposed. One more note: We could mirror the graph (put A4 on the left and A3 on the right)also without any change to meaning.You can interpret the arrows as the direction that computations must happen; thus A1 is dependent onA2 and A3 (A2 and A3 must be computed before A1). A2 is dependent on A3 and A4 (A3 and A4 mustbe computed before A2). The direction of the arrow is just convention.From the second view, you can also determine the order of evaluations that must take place,i.e., either A3 or A4 first, then the other (A3 or A4), then A2, and finally A1.
1/27/23, 11:19 AMAssignment Two – Dependency Graphhttps://utah.instructure.com/courses/834041/assignments/11982609?return_to=https%3A%2F%2Futah.instructure.com%2Fcalendar%23view_name%3Dmonth%26…4/15Important: you are not writing the traversal code for the graph. See the starter code (API) given belowfor the methods you are to write.5. Notation – Dependee vs DependentWe will use the terms “dependent” and “dependee” as nouns, having critical meanings that are importantnot to confuse.Dependent: (or depender) – a node that depends on another node. In the example above, A4 hasone dependent: A2. The set of A3’s dependents is {A2, A1}.Dependee: – a node that is depended upon. The set of A1’s dependees is {A2, A3}.Warning: Saying something is dependent on something else defines both the dependents and thedependees. For example, when we say: “A2 is dependent on A4”, this implies that A4’s dependents areA2 and A2’s dependees are A4. I suggest you refer to the diagram for this simple graph whenever youare puzzling over Dependee vs Dependent.To further help you, use the following defintions:1. Dependents: After : Asking for a node’s set of dependents is asking: “who depends on me?”, or”what must be calculated after this node?”2. Dependees: Before: Asking for a node’s set of dependees is asking: “who do I depend upon?”, or”what must be calculated before this node?”If a node has an empty set of dependents, then nothing is a dependent of it. There are no nodes thatmust wait for it to be computed before they are computed. A1 is such a node.If a node has an empty set of dependees, then it is a dependent of nothing. Its value can be calculatedat any time. A3 and A4 are such nodes. The full set of relationships for the example is given in the table below:CellDependentsDependeesA1{}{A2, A3}A2{A1}{A3, A4}A3{A1, A2}{}A4{A2}{}
1/27/23, 11:19 AMAssignment Two – Dependency Graphhttps://utah.instructure.com/courses/834041/assignments/11982609?return_to=https%3A%2F%2Futah.instructure.com%2Fcalendar%23view_name%3Dmonth%26…5/15If a node does not exist in the graph, it is considered to have an empty set of dependents anddependees. For example, say I define a new cell in the spreadsheet A5. The content of A5 is “5+5”. Wecan compute the value (i.e., 10) at any point. No other cells are dependent on this cell and this cell is notdependent on any other cells. Important Question: Why don’t we need to list A5 in the chart above? Note 1: The graph only stores the direct dependents and dependees for a given cell. Indirectrelationships can (must) be inferred using the proper algorithms. Indirect relationships are not yourconcern in this assignment, and this should be a big hint as to how to represent your graph.Note 2: you do not need to prevent cycles in your dependency graph. We will allow them for now, anddetect them in a later assignment.6. Visual Studio – Solution StructureWe will continue to develop in our Spreadsheet Solution. You should open Visual Studio and return tolast week’s code base.In this solution you will add two new Projects. One for a new library. One for a test suite. Informational: While we are still working in the Spreadsheet solution, the console app and formulaevaluator library from last time will not be used this week.6.1. Versioning – Add a Tag to Your WorkSTOP! Before going any further, add a TAG to your GitHub Spreadsheet project!
1/27/23, 11:19 AMAssignment Two – Dependency Graphhttps://utah.instructure.com/courses/834041/assignments/11982609?return_to=https%3A%2F%2Futah.instructure.com%2Fcalendar%23view_name%3Dmonth%26…6/15Tagging is a way to denote important milestones in your codes progress. Often this could be when anAlpha is finished, or a version 1.0 has been completed… For our purposes, we will use the number ofthe assignment as the version.1. GIT –> View Branch History2. In the History window, right click on the most recent commit –> New Tag3. Tag Name: v1.04. Tag Message: Finished (I hope) with first assignment.5. Create6. Refresh the history window by clicking the circle arrow icon. You should see a green V1.0 next tomain. 7. Push your tag to Git Hub: Use the … menu and choose push all tags.This will allow you (or TAs) to easily find the state of the project before the second assignment andafterward.6.2. Project 1 : Dependency Graph Library ProjectCreate a a new Project called “DependencyGraph”. (Note: type class library, Net Core 6, and ofcourse C#.)In this project rename the default C# file to: DependencyGraph.cs. The contents of the file can bereplaced with this starter code (https://utah.instructure.com/courses/834041/files/143432721?wrap=1) (https://utah.instructure.com/courses/834041/files/143432721/download?download_frd=1) (https://utah.instructure.com/courses/754704/files/125400785/download?download_frd=1) which defines theAPI for the functionality you are to implement. The API is the contract specifying the methods, names,etc., of what you need to create. You are required to implement the specification (API) as written in thesample file, so read it carefully. Note: if a method (e.g., Traversal) does not appear in the API, you arenot required to implement it. See the section API below.Half of your development effort for this assignment will be in this file. The other half will be creating testsfor this code.Important: you may not modify any of the public aspects of the DependencyGraph class in any way, butyou may add private methods and variables to your heart’s content*, as well as any needed helperclasses. *-Respecting good Software Engineering practices. Question: Why can’t we change the public methods? The public methods define the API that otherdevelopers will expect. They may be working on other programs that use dependency graphs, or havelegacy code that is already written. In both cases, they expect that the method signatures in the
1/27/23, 11:19 AMAssignment Two – Dependency Graphhttps://utah.instructure.com/courses/834041/assignments/11982609?return_to=https%3A%2F%2Futah.instructure.com%2Fcalendar%23view_name%3Dmonth%26…7/15Dependency Graph class do not change. If they did change, all these other developers would have togo re-write their code!6.3. Project 2 : Dependency Graph Tests ProjectLike in the previous assignment, we are creating another library (which compiles to a DLL). Unlike theprevious assignment, we will now use formal unit testing to help validate our code. C# supports avariety of unit testing solutions. The one we are using will be MSTEST. Most of this functionality is builtdirectly into Visual Studio. Unit Testing can help you quickly identify mistakes in your code.Create yet another Project called: “DependencyGraphTests”. (Note: type MSTest, Net Core 6, C#) In this project rename the default C# file to: DependencyGraphTests.cs.To try and convince you of the utility of creating a tests before creating solutions, we will provideyou with the following code to start your testing.Unit Test Starter Code (https://utah.instructure.com/courses/834041/files/143432720?wrap=1) (https://utah.instructure.com/courses/834041/files/143432720/download?download_frd=1) (https://utah.instructure.com/courses/754704/files/127277536/download?download_frd=1)This is a small hop along the path called; “Test Driven Development (TDD)”. TDD starts with the tests,and then later creates the functionality. Hopefully you will learn that having tests from the start is avaluable tool in the development process. You are required to modify and/or add to the test project as necessary to help assure yourself of thecorrectness of your library. While testing cannot on it’s own prove correctness, a strong test suite withfull code coverage, will go a long way toward this process.As always, be sure to use proper commenting so that your class and method comments are parsed andmade available to Intellisense using XML. Let me be clear: you must document your tests!Note: upon first creating the unit test suite, you will find that it won’t compile. Why? What _simple_change do you need to do to fix this?6.4. Extension LibraryAs we move further along with our project, some of you will develop “helper” code that can be usedacross your solution. For example, while we are not writing our own Stack class, if we did, it wouldbelong to this “helper” category.Another example of helper methods that you might want is creating a method with the ability to check thetop element of a stack for particular values with a single method call. If this functionality is “generic”enough that you think it may be useful in other future projects, and deserves to be stand on its own,you should create a Project called Extensions (it must have exactly this name).
1/27/23, 11:19 AMAssignment Two – Dependency Graphhttps://utah.instructure.com/courses/834041/assignments/11982609?return_to=https%3A%2F%2Futah.instructure.com%2Fcalendar%23view_name%3Dmonth%26…8/15Any extra code that you rely on that is not in your main project, must be in this Extensions project. Theauto grader will check for it’s existence and link to it as appropriate.Note: this is not required for this assignment, but optional for those who wish to add “generic helper”code.7. Testing – Regression Testing & Test DrivenDevelopment7.1. TestingAgain, we will go over testing more extensively in Lab, but to help you get started, here are someinstructions:To run your tests, click the Test drop-down menu: Tests -> Run All Tests. Note: If VS doesn’t “see” yourtests, you will need to rebuild your project to make it discover them. You also have options to runspecific tests, run tests that didn’t pass in the past, debug tests, etc.Finally it should be noted that the provided tests are not comprehensive and passing them does notguarantee anything about your grade and only minimal guarantees about the functionality of yoursystem. Furthermore, they will not come anywhere close to exercising every line of code in yourDependencyGraph. Part of your grade in this assignment will be determined by how thoroughly yourtests cover your code.7.2. Regression Testing and Unit TestsThe term “regression testing” is used in the context: (1) A program exists (that might be correct) and (2)New features are added to the program. Of course, the very act of adding new features (more code) to aprogram is likely to add more errors, perhaps causing (or finding) errors in previously working code!Regression testing requires that a suite (collection) of tests have been built to try and validate the codebase. Thus, if a developer makes new changes to the program that invalidate the old “truths” (i.e., youbreak the existing code while adding new features) the test suite should (might?) let you know.It is up to the developer (you) to create tests as your write your code. Every function you write shouldlikely have several tests.Finally: Once again as each tests is developed to test a small “unit” of the program, these are called UnitTests.7.3. Test Driven Development (TDD)The term “test driven development” refers to the idea of writing tests before the implementation of themain code. The idea is first, to understand the problem (what inputs and outputs are expected), second,
1/27/23, 11:19 AMAssignment Two – Dependency Graphhttps://utah.instructure.com/courses/834041/assignments/11982609?return_to=https%3A%2F%2Futah.instructure.com%2Fcalendar%23view_name%3Dmonth%26…9/15to define the API, third to write explicit tests, and finally, to implement the program features. As yourimplementation proceeds, you will continually run the previously created tests to help ensure that youare meeting the requirements of the program.In a large company, it might even be a different team writing the tests in isolation from the teamdeveloping the code. Large test suites will sometimes have to be run overnight as they can takeconsiderable time to execute. Your test suite should complete in seconds.As stated above, for this assignment we have provide you with a starting point of unit tests. Make sureyou understand the following points:1. Tests only show where the program is incorrect, they do not prove a program is correct.2. Tests almost always are a random sampling of a program, in much the same way that a midterm is arandom sampling of your understanding. The more tests (or questions on an exam), the better thesampling. That being said, your tests should “execute” every line of code in your program.3. Tests themselves are written in code, and thus can be wrong (and have to be debugged)…8. API vs ImplementationAn API is an “application programming interface”, or a fancy way of saying what functions must beprovided, along with their names and type signatures, and some documentation detailing what thefunctions should do.As you have also learned there are various ways to implement a graph. You can use linked structures,arrays, hash tables, etc. The implementation is your choice.That being said:you must honor/respect/utilize the given API for the “outward facing” part of your program; thus therecan be no changes to the signatures of public methods.your program must be efficient; i.e., choose appropriate data structures that allow fast access toneeded dataAs you should know, the implementation details of a data structure (the private parts) are not the concernof the user of the class. Thus, for your dependency graph the choice of internals is up to you, but it mustbe a good choice based on your knowledge of data structures. Caveats are:1. if your “private implementation” is so bad that it cannot compute an answer in the required time (orcannot compute the right answer) then the user of the class may be concerned :^) and the gradingtests will not give you credit.2. in the Real World, the “user” of the class is probably someone else. In this class, you (wearing adifferent hat) are the “other” user.
1/27/23, 11:19 AMAssignment Two – Dependency Graphhttps://utah.instructure.com/courses/834041/assignments/11982609?return_to=https%3A%2F%2Futah.instructure.com%2Fcalendar%23view_name%3Dmonth%2…10/15Just to be redundant: The API is defined by the public method signatures in the Dependency Graphstarted code provided above.9. Track your Work HoursPart of becoming a good developer is forming the ability to estimate and track the time it takes tocomplete a project. 1. Estimate how much time you think this assignment will take. This estimate should be in hours and bemade after you have fully read this page/description/documentation. Add this to your READMEnow!2. Track the time spent. It would also be useful to try and distinguish between time spent effectively(making progress toward completion), time spent debugging (fixing errors introduced in code), andtime spent learning tools and techniques (hopefully a one time cost). Before submitting your finalwork, add these numbers to your README. (I recommend that you track your time in theREADME after every work session throughout the week, and then summarize before handing in thework).Warning: failure to record your estimated and final times in your README we will result in -10points.10. README10.1. Project READMEsAs always, a README is required in every project. Some READMEs will be more important than othersfor an assignment, but all must give a high level description of the purpose of the project and declareyour “ownership” of the code. Also, don’t forget to start your new list of references for this phase of the program, including students youbounce ideas off of.10.2. The Solution READMEIn your Solution README, you should update the description of what the entire project can now do. Further, update the “Hours Estimated/Worked” table. Do not delete the old hours, but make a table ofsorts showing the new hours, e.g., Hours Estimated/Worked Assignment Note 6 / 12 – Assignment 1 – Formula Evaluator Spent 4 extra hours fighting git, otherwise good. 12 / 13 – Assignment 2 – Dependency Graph …
1/27/23, 11:19 AMAssignment Two – Dependency Graphhttps://utah.instructure.com/courses/834041/assignments/11982609?return_to=https%3A%2F%2Futah.instructure.com%2Fcalendar%23view_name%3Dmonth%2…11/1511. Quality CriteriaAs with all assignments in this course, you will be evaluated on how well your code solves the givenproblem and your “software practices” (e.g., the quality of your code design, commenting,documentation, .etc. Please see the course page on good software practice and common code qualitymistakes (https://utah.instructure.com/courses/834041/pages/common-code-quality-mistakes) ). Special consideration will be given to the following software practices:Testing – How thorough are your tests, do they cover your code, do they test “edge” cases, etc. Versioning – Multiple Commits over time, good commit messages, etc.Data Protection – Private/Public methods, Getters and Setters, etc.Code Complexity – Use of helper methods, built-in data structures, etc.Documentation – High level information on what complex parts of your code do.Code Quality – How easy is it to understand. Would a TA like to be your partner on the nextassignment?12. Individual and Original Work Please see the course guide on Academic Misconduct(https://utah.instructure.com/courses/834041/pages/academic-behavior-policies) and the README (https://docs.google.com/document/d/1Z3BSKeWLXac46thgVDS6rnNFzJGwlP6utTIPgfeTJGU/edit?usp=sharing) . You are responsible for this information.This is an individual assignment. You should write all of your code from scratch. If you are having aproblem doing so, please speak with me or a TA. You can work in proximity to your peers and talkthrough the benefits and drawbacks of various implementations, but when working on the computer thework should be your own. You can also discuss broad testing strategies and ways to achieve better andmore comprehensive testing. Ideas discussed with others should be implemented on your own. Feel freeto utilize the Piazza forums as well (just don’t post solution code).Don’t forget the “get pizza” rule. If you work with one ore more students (at a whiteboard) turning ideasinto code (and presumably learning), you should then go each a piece of pizza (or otherwise delay forabout 30 minutes (perhaps play a game of boggle)) and then return alone to your compute. At thatpoint, if you have learned you should be able to write the code on your own, not just “copy it frommemory”.13. Submitting
1/27/23, 11:19 AMAssignment Two – Dependency Graphhttps://utah.instructure.com/courses/834041/assignments/11982609?return_to=https%3A%2F%2Futah.instructure.com%2Fcalendar%23view_name%3Dmonth%2…12/15PS2 RubricThis tool needs to be loaded in a new browser windowAs you make progress, you should be committing multiple times to your GitHub repository. Before thedue date, you should have all of your working code committed and pushed.Once you have thoroughly tested your code and believe it to solid, go to Gradescope and pull yourproject from your GitHub repository. The Autograder will again tell you if your code at least compiles. Asalways, failure to submit compiling code will result in a zero.14. HintsIt may be that for efficiency reasons, you choose to use multiple data structures to representindependent parts of your dependency graph (e.g., the set of “forward” dependencies, and the set of”backward” dependencies). If so, make sure you enforce an invariant in your code: modifications to addor remove a dependency must modify every data structure used in the implementation.As a rough guideline to help you pick the right data structure(s), determining if a certain node exists inthe graph should have constant time complexity O(1).
1/27/23, 11:19 AMAssignment Two – Dependency Graphhttps://utah.instructure.com/courses/834041/assignments/11982609?return_to=https%3A%2F%2Futah.instructure.com%2Fcalendar%23view_name%3Dmonth%2…13/15CriteriaRatingsPts60 pts 5 pts 35 pts Grading Tests and Test Coverage Wewill run our own tests about theexpected behavior of youralgorithm/code and you will receive ascore for this. Additionally: Tests arethere to help ensure correctness andto show you when new functionality(new code) results in breaking oldbehavior. Thus there should be asignificant number of meaningful testcases which, when they fail, are likelyto be informative. Further, thecombination of all tests should causeevery line of code to be executed.60 ptsFull Marks0 ptsNo MarksREADMEs – ContentEvery README should be in placeand contain meaningful/requiredinformation. Even a single missingREADME will result in an extra andlarge point deduction.5 ptsFull Marks0 ptsNo MarksSoftware PracticeData Protection – The member variables that are usedto represent a DependencyGraph areexplicitly declared private. (Ifproperties are used, they have privateget and set). Helper functions areprivate. Public helper classes are OK if theydon’t violate data protection. Documentation – Each file and function is properlydocumented with the appropriate levelof detail. – The strategy used to representDependencyGraphs is documentedwith comments associated with themember variables. – Large blocks of complex code aredocumented. – XML documentation practices arecontinued. 35 ptsSuperior28 ptsGood21 ptsFair14 ptsAcceptable7 ptsNeedsWork0 ptsNoMarks
1/27/23, 11:19 AMAssignment Two – Dependency Graphhttps://utah.instructure.com/courses/834041/assignments/11982609?return_to=https%3A%2F%2Futah.instructure.com%2Fcalendar%23view_name%3Dmonth%2…14/15CriteriaRatingsPtsCode Presentation and Complexity – The code is well-formatted and easyto read. Multiple functions are used tosimplify complex problems – Names ofmember variables and local variablesare well chosen and contribute to theease of reading the program. – Thecode in the class was constructed withcare. It is not overly complicated.Obvious ways to simplify it were notoverlooked. Students should be using a consistentstyle that is easy on the eyes. Thelarger the scope of a variable, themore descriptive its name should be.For example, “i” is an OK loop indexvariable, but it is a terrible membervariable. Other: See the “Quality Criteria” section ofthe assignment for more information.Note that the Quality Criteria for PS1apply here, and on all futureassignments as well. The goal of a program is to solve aproblem. The goal of a SoftwareEngineer is to build a program that notonly solves the current problem, but isalso as error free as possible, AND tobemaintainable/readable/understandableby the next new person who comesalong and is put in charge of using itto solve the next problem. Followingrequirements, providing thoroughtests, making your code readable,choosing proper data structures,dividing your code into appropriateclasses and/or methods, using properversioning, etc., are all part of goodsoftware practice. This categoryrepresents the “team lead’s” overallcategorization of your work. Pleasenote that this score is influenced by
1/27/23, 11:19 AMAssignment Two – Dependency Graphhttps://utah.instructure.com/courses/834041/assignments/11982609?return_to=https%3A%2F%2Futah.instructure.com%2Fcalendar%23view_name%3Dmonth%2…15/15Total Points: 100CriteriaRatingsPtsthe above categories and representsadditional points associated withthose categories as well as the”overall software practice” category.

Place this order or similar order and get an amazing discount. USE Discount code “GET20” for 20% discount