Imagine we have some cells, and you can teleport in other cells through portals, there exists some "teleporting" time for every cell, but there are also some guardians, while a guardians is in the cell you're in you have to wait until the moment he…
I recently got interested in graph theory. I came across the s-t cut for a directed graph. I learned online that the min-cut is equal to the max flow and there are standard algorithms out there that can solve the s-t min cut for a directed graph.…
I am trying to learn how to implement graphs (Depth First Search) into java.
And here is a piece of code that I do not understand what a character means in here. It is about this piece of code:
private void dfs(Graph G, int v) {
count++;
…
I am currently doing a school assignment that wants us to model a bus route map using graphs (undirected), where the edges represent roads which has labels set to the bus route letter (one road may have have bus a, but another may have bus b) and…
In a binary tree, each parent has a reference to its child nodes. There is a direction from each parent node to each of its child node as shown in the tree image below. So how come it is defined as an undirected graph?
One more question I have…
The following C# algorithm I wrote detects the existence of a cycle in an undirected graph in O(n) time. It avoids recursion and takes advantage of hashing via Dictionaries and HashSets. But is there a way I can do even better?
void Main()
{
…
I am working on the problem of trying to segment an image based on straight edges to try to get closed quadrilaterals. I have been able to extract line segments using an edge detector.
Is there a good way to connect edges that would be "nearly…
I have an undirected weighted graph G=(V,E) where V represent nodes and E represent edges. Through Dijkstra Algorithm, I got a shortest path tree Ts=(s,V) rooted at source node s and spanning all nodes V in the graph G. Then I selected a sub-tree…
I have five elements A, B, C, D and E.
The distance between each of the elements is given by the matrix below:
Distances =
[0 5 3 8 15;
5 0 7 5 20;
3 7 0 12 12;
8 5 12 0 8;
7 20 12 8 0]
I want…
We can assume that all edge weights are positive, and that you can enumerate the edges leading outwards from a vertex, and likewise the edges leading inward, in O(1) time.
For example, you can perform Dijkstra traversal (or A*, with an admissible…
I'm testing igraph python to plot undirected graph. The problem is that the labels get cuttoff for some reasons. The labels contain spaces, so I had to replace the spaces with underscore.
For examples:
If the label is Mike_Jorden then only e_jorde…
I have a grid of connected paths as shown below:
The grid is a 2D array created as follows:
for(var x = 0; x < 10; x++){
hz[x] = new Array(10);
for(var y = 0; y < 10; y++){
hz[x][y] = new block(0, 0, 0, 0, 0);
…
I am looking for an algorithm, when a given two nodes 's' and 't' in a undiredted graph, to find min-cut edges, which partitions the graph into two A and B, 's' will in A and 't' will in B.
I see most people suggesting for Ford–Fulkerson algorithm…
How can I remove all cycles from a graph like this? All edge lengths are one, and all edges are either vertical or horizontal. The graph is connected.
I want to compute the smallest number of edges that have to be removed in order for the graph to…
I have this maze which represented as undirected graph.
Here's how it looks like:
11 3
2 3
0 3
1 4
5 4
5 7
6 7
7 8
8 9
9 10
6 11
7 11
In this graph, with the use of depth-first search and it shows me a solution from start node to goal node. My…