Well I assume you arent given a "Vertex" class or anything, so thats where you would start I imagine. A simple "struct Vertex" is probably good enough--it needs two fields, the vertex it is connected with, and the cost of that edge. So something like this should be ok (the syntax might be incorrect, because I dont remember the syntax--but thats a minor detail)
Code:
struct Vertex
{
int vertex;
int cost
}
Overall, the struct might be a "vector" of "linked lists" of "Vertex"s. Each element in the root container "vector" contains a list of vertices, which is your adjacency list.
Say we had a small direct weighted graph and it is represented as a triple (v1, v2, w) where v1 is a vertex that goes to v2 with cost w. Say we have: (1, 2, 0), (1, 3, 5), (2, 3, 1), (3, 1, 0). This could be represented as a vector with 3 linked lists, such as:
1 -> (2, 0), (3, 5)
2 -> (3, 1)
3 -> (1, 0)
Where, for example edge 1 goes to edge 2 with weight 0, and also to edge 3 with weight 5, etc.
there is a function called weightedGraph(Costtype none) that is supposed to create a directed graph giving all edges a weight of none.
Well to create the graph you need to know the vertices and which one goes to which. Therefore you need more than just a "costtype none" argument. You would need something like an array/list/vector/any collection of "Vector"s. So you take in the list of pairs of vertices and assign them all weight 0.
If you are overwhelmed with some task, such as this, do not look at the big picture (in my opinion): start with the very basics, which is the required data structure which is what I described above. After you have that then try and create one given, say, a 2-d array of integers, i.e.
Code:
vector<list<Vertex>> createGraph(int ** vertices, int len)
Of course, again the syntax might not be exact because I dont remember it and am just typing it without testing. So the function takes in a 2-d array of integers with length "len", so using the example vertices I said above, it might be called like:
Code:
int vertices[4][2];
// pair (1,2)
vertices [0][0] = 1;
vertices[0][1] = 2;
// pair (1,3)
vertices[1][0] = 1;
vertices[1][1] = 3;
// pair (2,3)
vertices[2][0]=2;
vertices[2][1]=3;
//etc
vector<list<Vertex>> = createGraph( vertices, 4 );
So this function should create a vector linkedlists of "Vertex" structs, and assign each "weight" field 0. For example, at index 1 of the vector you create the linked list with "Vector" structs (2, 0), (3,0).
Anyways, I think Ive given more than enough to get you started.