CMPUT 201 use c99 to code Part 1: Graphs and linked lists In this part of the...
Part 1: Graphs and linked lists In this part of the lab, you will work with linked lists by creating a graph representation. A graph is an abstract data structure, in which there are nodes and edges between nodes. The graph representation we will be using in this lab is the adjacenty list, which is an array of linked lists that shows the edges in the graph. Here is an example of a simple graph and its adjacenty list: Adjacenty List Representation: 0 3 1 0 2 5 . 2 5 . 3 0 2 4 5 5 2 4 . Note that, in this lab, the nodes are labelled from 0 to n - 1, where n is the total number of nodes. In this lab, given the number n, of nodes and a collection of m edges (which are stored in a two-dimensional array int edge [m] [2] ), your task is to develop the adjacenty list representation of the graph. You will work with the following struct (defined in 1ab11. h ) that represents a node in the graph: struct graph_node { int label; // the label of the node in the graph struct graph_node *next; // pointer to next node; NULL if there is no next node
Written for
- Institution
-
University Of Alabama School Of Medicine
- Course
-
CMPUT 201
Document information
- Uploaded on
- November 19, 2022
- Number of pages
- 11
- Written in
- 2022/2023
- Type
- Exam (elaborations)
- Contains
- Questions & answers
Subjects
-
university of alberta cmput cmput 201 use c99 to code part 1 graphs and linked lists in this part of the