I am taking data structure subject on my university. And I got an assignment to make a graph with vertices and edges. And I don't know where to start. Can anyone give me the basic idea on how to implement it so that I can start writing my own code? Thank you.
You could use an adjancency matrix. Basically, you have a two dimensional array of n by n size. Each index [i][j] represents a connection between the edge i and j. If index [i][j] is 0, there is no connection. If [i][j] is >= 1, then there is a connection. Usually a number higher than 1 indicates a 'cost' to travel between those two edges. If you do not need to have costs to travel between edges, than an array of bool types should be sufficient (true for connection, false for none)If it is an undirected graph, then you must set [i][j] to the same value as [j][i]. If you can have different directions in the graph then [i][j] can be different than [j][i].
There is also an adjacency list implementation, where every vertex is represented by a node linked to whichever nodes it is connected to in a list.
These are all things your prof. should have covered in class already. Then again, I've had some horrible profs as well.