Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   M S T probs (http://www.go4expert.com/forums/m-s-t-probs-t15747/)

xenoglaux 7Jan2009 10:39

M S T probs

I've wrote a code for MST with prim's
I wonder if i can change the output from

int graph[8][8]={{0,1,99,1,99,99,99,99},

to something like this

int data[Total][3]={ {1,2,3},{1,5,2},{1,6,5},{1,10,1},
{7,9,5},{7,8,9},{8,9,6} };
i mean not only i can input 0 ,1 and 99

but i can input this something like 2 ,3 5 and so on...
should i change the code? to vertices matrix? or is there any possible way for me just to input 2 ,3 ,5 and so on?

my currently codes just respond to 0,1 and 99. but when i just put the number it seems very normal the output. It's just i don't know how to write the input like the 2nd conditions.

xenoglaux 7Jan2009 10:59

Re: M S T probs
since the code i wrote has the input vertices

input vertices 8
input the cost of matrix = 0 1 99 1 99 99 99 99
and so on like the 1st condition

But for the 2nd condition
the input vertices 8
but how can i write the cost of matrix? at the second condtion the matrix input is not 8x8.
well actually i have 8 edges. but how to write the costs input for the 2nd condition?

All times are GMT +5.5. The time now is 19:20.