My implementation for directed graph works fine. It's a "lazy" version because it uses simple priority queues instead of indexed ones. I changed the code to get a solution for undirected graphs but it doesn't work. dijkstra(int s) is a method of a…
I created a program that solves a maze that reads a text file input. I managed to solve it using Depth-first Search and the result was fine on small mazes like this:
11 3
2 3
0 3
1 4
5 4
5 7
6 7
7 8
8 9
9 10
0 5
Everything was fine solving small…
I need to find the minimum distance between two nodes in a undirected graph, here are some details
The graph is undirected and huge(no of nodes is in order of 100,000)
The graph is sparse, no of edges is less than no of nodes
I am not interested in…
Let A be the NxN adjacency matrix of an undirected unweighted network, without self-loops. Let 1 be a column vector of N elements, all equal to 1. In other words 1 = (1, 1, ..., 1)T , where the superscript T indicates the transpose operation. Use…
We are provided with an undirected graph, source node, destination node and the weight of an extra edge which you can use to connect any two nodes which were not connected earlier. You have to find the minimum weight of the path possible between the…
I have an exercise for university where I have to write a DFS algorithm to run on an undirected graph. I also have to make the program sum the values of all nodes show the order in which the nodes were visited.
Here is the given structure:
#include…
Code Instructions
Hey guys. Above is a coding project I have been assigned. Im reading the instructions and am completely lost because I've never learned how to code an undirected graph? Not sure how my professor expects us to do this but I was…
Question
I have a question about this problem:
Given an directed graph that contains N vertices and M edges, please determine that "there is a path from vertex i to vertex j for all 1 <= i, j <= N".
I want to solve for N <= 500, M <= 250000.
I…