#### Category : graph-algorithm

Recently I came upon the Johnson’s algorithm to find "elementary circuits" on a directed graph, which is really cool to me. I’m just implementing it from scratch in C++ following the original Johnson’s paper. I have a couple of doubts before going on. In the paper it’s clear to me what \$A_k\$ about adjacency, but ..

I’m trying to figure out how to implement djiktra algorithm to find the shortest path between 2 unweighted graphs. The suggestion I got was to use 2 graphs one for the red color and one for the blue color.The cost is always 1 to travel but to access a red square while being blue you ..

I have a directed Graph data structure that implements the hits algorithm, to find the authority and hub values of each vertex in the Graph. I used a 2D vector for an adjacency matrix representation. I have two boolean values (iter_bound & err_bound)that are the stopping condition for the algorithm. I have the stopping condition ..

There are n cities and m possible roads and k temples. The cost of each road is given. Build roads with minimum cost such that each city has access to at least 1 temple. Note Input : There can be multiple roads(edges) between two cities. The first line contains n, m and k. And the ..

I can already find the "cost" of the tour with my code, but I would like know the tour that is being followed, for example my code is trying to find the lowest cost in this graph: but I want to know the tour, so ideally I would get either 1-2-4-3-1 or 1-3-4-2-1 both with ..

I’ve been trying to make this program save the vertices that make the cycle in the graph. But I’m kind of a newbie in algorithms and achieving that functionality seems a bit complex when using BFS. The code below successfully finds cycles, but the question is how to modify this code so I can print ..

I am trying to solve flight routs, in graph algorithms on CSES. CSES is a site the contains a collection of competitive programming practice problems. This I the problem I am trying to solve https://cses.fi/problemset/task/1196. The question is to find the K shortest routes from vertex 1 to n, in a given wheighted graph. For ..