Answered step by step
Verified Expert Solution
Question
1 Approved Answer
?PLEASE CODE IN C AND DISPLAY YOUR OUTPUT! THANK YOU IN ADVANCE! CS 2123-001 Data Structures Instructor Dr. Turgay Korkmaz Homework 6 Due date: check
?PLEASE CODE IN C AND DISPLAY YOUR OUTPUT! THANK YOU IN ADVANCE!
CS 2123-001 Data Structures Instructor Dr. Turgay Korkmaz Homework 6 Due date: check BB Learn !!!NO LATE HOMEWORK WILL BE ACCEPTED!! (Graphs graph functions) You are given the basic code that we implemented in the slides to create/read/print graphs. First copy/paste it into a file say graph.c and compile/run it gcc graph.c-o graph > ./graph graph filename For sample graphs, again copy/paste the below graph data into a file undirectedgraph1.txt and directedgraph1.txt then run your program a:s ./graph undirectedgraph1.txt > ./graph directedgraphl.txt directedgraph1.txt 6 8 1 1 2 3 2 3 1 3 1 6 3 5 2 4 2 5 4 5 3 4 6 6 undirectedgraphl.txt 1 2 3 1 3 6 3 5 2 4 5 3 4 6 6 5 6 1 After studying and understanding the given code, first modify insert edge) function so that it can keep the link list sorted w.r.t. neighbor IDs. Second implement graph_copy) to create a copy of the given graph. User will call the original graph as myg1 and the copy as myg2, for which we use the same pointer names in the program. Now extend the main function so that it can asks user to enter various commands in a loop and performs these commands on the related graphs. Accordingly you also need to implement those functions and call them. Finally when ending the main function, make sure you free the graphs -- see more explanations that are at the end of this handout--.....-.- CS 2123-001 Data Structures Instructor Dr. Turgay Korkmaz Homework 6 Due date: check BB Learn !!!NO LATE HOMEWORK WILL BE ACCEPTED!! (Graphs graph functions) You are given the basic code that we implemented in the slides to create/read/print graphs. First copy/paste it into a file say graph.c and compile/run it gcc graph.c-o graph > ./graph graph filename For sample graphs, again copy/paste the below graph data into a file undirectedgraph1.txt and directedgraph1.txt then run your program a:s ./graph undirectedgraph1.txt > ./graph directedgraphl.txt directedgraph1.txt 6 8 1 1 2 3 2 3 1 3 1 6 3 5 2 4 2 5 4 5 3 4 6 6 undirectedgraphl.txt 1 2 3 1 3 6 3 5 2 4 5 3 4 6 6 5 6 1 After studying and understanding the given code, first modify insert edge) function so that it can keep the link list sorted w.r.t. neighbor IDs. Second implement graph_copy) to create a copy of the given graph. User will call the original graph as myg1 and the copy as myg2, for which we use the same pointer names in the program. Now extend the main function so that it can asks user to enter various commands in a loop and performs these commands on the related graphs. Accordingly you also need to implement those functions and call them. Finally when ending the main function, make sure you free the graphs -- see more explanations that are at the end of this handoutStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started