Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- //Code (Adjacency Mat.)
- int V,E;
- cout << "Vertex :";
- cin >> V ;
- cout <<endl<<"Edge :";
- cin >> E; //
- int weight[V][V];
- for(unsigned int e=0;e<E;e++)
- {
- int i,k,w;
- cout << "i :";//Vertex at i
- cin >> i;
- cout << "k :"; // Vertex at k
- cin >> k;
- cout << "w :";// weight
- cin >> w;
- weight[i][k]=w;
- }
- /* testcase
- 5 10
- 0 0 2
- 0 1 3
- 0 2 1
- 1 3 3
- 2 0 3
- 2 1 2
- 2 4 2
- 3 2 1
- 3 4 1
- 4 1 1
- */
- }
Advertisement
Add Comment
Please, Sign In to add comment