//
// main.cpp
// Adjacency Matrix
//
// Created by Himanshu on 26/11/22.
//
#include <iostream>
#include <vector>
#include <cmath>
#include <climits>
#define N 5
using namespace std;
//N = number of nodes in graph
void printAdjacencyMatrix(int G[][N]) {
for (int i=0; i<N; i++) {
for (int j=0; j<N; j++) {
cout<<G[i][j]<<" ";
}
cout<<endl;
}
}
int main() {
int G[N][N] = {{0, 1, 0, 0, 0},
{1, 0, 0, 1, 0},
{0, 0, 0, 1, 1},
{0, 1, 1, 0, 1},
{0, 0, 1, 1, 0}};
cout<<"Graph G (Adjacency Matrix):"<<endl;
printAdjacencyMatrix(G);
return 0;
}
Ly8KLy8gIG1haW4uY3BwCi8vICBBZGphY2VuY3kgTWF0cml4Ci8vCi8vICBDcmVhdGVkIGJ5IEhpbWFuc2h1IG9uIDI2LzExLzIyLgovLwogCiNpbmNsdWRlIDxpb3N0cmVhbT4KI2luY2x1ZGUgPHZlY3Rvcj4KI2luY2x1ZGUgPGNtYXRoPgojaW5jbHVkZSA8Y2xpbWl0cz4KI2RlZmluZSBOIDUKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCi8vTiA9IG51bWJlciBvZiBub2RlcyBpbiBncmFwaAp2b2lkIHByaW50QWRqYWNlbmN5TWF0cml4KGludCBHW11bTl0pIHsKICAgICAKICAgIGZvciAoaW50IGk9MDsgaTxOOyBpKyspIHsKICAgICAgICBmb3IgKGludCBqPTA7IGo8TjsgaisrKSB7CiAgICAgICAgICAgIGNvdXQ8PEdbaV1bal08PCIgIjsKICAgICAgICB9CiAgICAgICAgY291dDw8ZW5kbDsKICAgIH0KfQoKaW50IG1haW4oKSB7CiAgICBpbnQgR1tOXVtOXSA9IHt7MCwgMSwgMCwgMCwgMH0sCiAgICAgICAgICAgICAgICAgICB7MSwgMCwgMCwgMSwgMH0sCiAgICAgICAgICAgICAgICAgICB7MCwgMCwgMCwgMSwgMX0sCiAgICAgICAgICAgICAgICAgICB7MCwgMSwgMSwgMCwgMX0sCiAgICAgICAgICAgICAgICAgICB7MCwgMCwgMSwgMSwgMH19OwogCiAgICAgCiAgICBjb3V0PDwiR3JhcGggRyAoQWRqYWNlbmN5IE1hdHJpeCk6Ijw8ZW5kbDsKICAgIHByaW50QWRqYWNlbmN5TWF0cml4KEcpOwogICAgCiAgICByZXR1cm4gMDsKfQ==