মডিউল ১৩_৪ঃ এডজেসেন্সি লিস্ট টু এডজেসেন্সি ম্যাট্রিক্স পার্ট-২




Previousমডিউল ১৩_৩ঃ এডজেসেন্সি লিস্ট টু এডজেসেন্সি ম্যাট্রিক্স পার্ট-১Nextমডিউল ১৩_৫ঃ এজ লিস্ট টু ম্যাট্রিক্স
Last updated




Last updated
// Some code
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
mat[i][j] = -1;
if (i == j)
mat[i][j] = 0;
}
}// Some code
for (int i = 0; i < n; i++)
{
for (pair<int, int> child : adj[i])
{
int childNode = child.first;
int cost = child.second;
mat[i][childNode] = cost;
}
}