Top "Graph-algorithm" questions

Graph Algorithms are a sequence of well-defined steps that will solve a problem related to Graph Theory, where a Graph in this context is a collection of vertices ("nodes") and edges that connect these vertices.

Can we apply the Bellman-Ford algorithm to an Undirected Graph?

I know that Bellman-Ford Algorithm works for directed graphs. Will it will work for an undirected graph? It seems that …

algorithm data-structures graph graph-algorithm bellman-ford
Optimal way of filling 2 knapsacks?

The dynamic programming algorithm to optimally fill a knapsack works well in the case of one knapsack. But is there …

algorithm dynamic-programming graph-algorithm knapsack-problem
Why does Dijkstra's Algorithm use a heap (priority queue)?

I have tried using Djikstra's Algorithm on a cyclic weighted graph without using a priority queue (heap) and it worked. …

graph-algorithm priority-queue dijkstra
Check if the given string follows the given pattern

A friend of mine just had his interview at Google and got rejected because he couldn't give a solution to …

string algorithm dynamic-programming graph-algorithm
How to modify dijkstra algorithm to find all possible paths?

I know that could be asked before already but I cannot find it. I need to modify below dijkstra algorithm …

c# algorithm graph-algorithm breadth-first-search dijkstra
Why is depth-first search claimed to be space efficient?

In an algorithms course I'm taking, it's said that depth-first search (DFS) is far more space efficient than breadth-first search (…

algorithm graph-algorithm breadth-first-search depth-first-search
How to implement Prim's algorithm with a Fibonacci heap?

I know Prim's algorithm and I know its implementation but always I skip a part that I want to ask …

algorithm data-structures graph-algorithm prims-algorithm fibonacci-heap
how can a breadth-first-search-tree include a cross-edge?

Well, I know that a breadth-first-search-tree of an undirected graph can't have a back edge. But I'm wondering how can …

algorithm tree graph-algorithm breadth-first-search tree-traversal
Negative Weight Cycle Algorithm

I was thinking about the algorithm of finding a negative weight cycle in a directed graph. The Problem is: we …

algorithm graph-algorithm bellman-ford
Reducing TSP to Hamiltonian circuit

How can I convert the (decision version) of the traveling salesman problem to the Hamiltonian circuit problem (i.e. how …

algorithm graph graph-algorithm np-complete reduction