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.

Algorithm for diameter of graph?

If you have a graph, and need to find the diameter of it (which is the maximum distance between two …

algorithm graph language-agnostic graph-algorithm
How to keep track of depth in breadth first search?

I have a tree as input to the breadth first search and I want to know as the algorithm progresses …

algorithm data-structures graph graph-algorithm
Python connected components

I'm writing a function get_connected_components for a class Graph: def get_connected_components(self): path=[] for i in …

python graph-algorithm connected-components
Detecting cycles in an adjacency matrix

Let A be the adjacency matrix for the graph G = (V,E). A(i,j) = 1 if the nodes i and …

matlab graph matrix graph-algorithm
Algorithm for finding a Hamilton Path in a DAG

I am referring to Skienna's Book on Algorithms. The problem of testing whether a graph G contains a Hamiltonian path …

algorithm graph-algorithm directed-acyclic-graphs hamiltonian-cycle
Why does Dijkstra's algorithm use decrease-key?

Dijkstra's algorithm was taught to me was as follows while pqueue is not empty: distance, node = pqueue.delete_min() if …

algorithm data-structures priority-queue graph-algorithm dijkstra
Comparing object graph representation to adjacency list and matrix representations

I'm currently following Steve Yegge's advice on preparing for a technical programming interview: http://steve-yegge.blogspot.com/2008/03/get-that-job-at-google.html In …

algorithm graph graph-algorithm
Why can't Prim's or Kruskal's algorithms be used on a directed graph?

Prim's and Kruskal's algorithms are used to find the minimum spanning tree of a graph that is connected and undirected. …

algorithm graph graph-algorithm prims-algorithm
How to prove max number of connection between n nodes is n*(n-1)/2

Given n nodes, if every node is connected to every other node (except itself) the number of connections will be …

algorithm graph graph-algorithm discrete-mathematics
Advantage of depth first search over breadth first search or vice versa

I have studied the two graph traversal algorithms,depth first search and breadth first search.Since both algorithms are used …

algorithm graph graph-algorithm