so this is my function it basically takes the 2 indexes and the 2D array and adds the weight to the intended place.
void AddEdge(int Vertex1Index, int Vertex2Index, int weight, int Edge)
{
if (Vertex1Index==-1 || Vertex2Index==-1) // in case of invalid vertex
{
return ;
}
Edge [Vertex1Index][Vertex2Index] = weight; //using indexes to enter weight
}
the problem is that my size is defined by the user at the start of the program (its required to do so) other wise I would have made the size a global constant.
this is how you call the function
AddEdge(SearchVertex(Value, Size, Vertices),SearchVertex(Value1,Size, Vertices),weight, Graph);
Search vertex searches the input in the vertices array and returns the index. if the vertex does not exist it returns -1.