51 questions
3 votes
0 answers
126 views
How can I efficiently detect cycles in a large, dynamically changing directed graph? [closed]
I am dealing with a large directed graph where nodes and edges can be added or removed dynamically during runtime. The main challenge is to detect cycles efficiently after each update without ...
0 votes
1 answer
80 views
Does this DFS approach for detecting cycles in a directed graph work correctly, or are there hidden issues?
I'm trying to detect cycles in a directed graph using a DFS-based approach in Java. I implemented a solution that uses a visited[] array and builds map from the input edge list. It seems to work ...
0 votes
2 answers
166 views
How to efficiently detect cycles in a directed graph with millions of nodes?
Graph Representation: I am using an adjacency list to represent a large directed graph with millions of nodes. Each node may have several outgoing edges, but the graph is sparse (few edges relative to ...
0 votes
0 answers
26 views
Approximate cycle detection in a sequence of tuples
I have a cyclic 1-D sequence of tuples of numeric values, and I'm trying to figure out the best way to find the length of the cycle. This is complicated by 2 factors: The sequence of values in one ...
1 vote
0 answers
181 views
What are the most efficient algorithms for detecting cycles in a directed graph?
I am working on a problem where I need to detect cycles in a directed graph. The graph is represented using an adjacency list, and it can have a large number of nodes and edges. I am looking for the ...
0 votes
0 answers
51 views
Detect Cyclic Islands on a Matrix
On a binary matrix M, a cyclic island is a region of 1s where the region encircles itself (horizontal, vertical and cross directions are allowed) Given a matrix M, Allowing neighbors to be in any of ...
0 votes
1 answer
122 views
Getting wrong answer while find a negative cycle
I've been working on implementing the Bellman-Ford algorithm in Python to detect negative cycles for the problem linked above. However, I've hit a roadblock. Despite my efforts, I've encountered ...
0 votes
0 answers
123 views
For a given node, how to find small cycles of which that node is a member?
I'm using python and graph-tool to do graph analysis. In a graph g, I want to find all cycles up to a specific length max_length of which a given node node is a member. Related question: How to ...
1 vote
2 answers
323 views
How to iterate simple cycles in ascending cycle length order?
I want to find all nodes of a graph, which are in simple cycles of length up to some given maximum cycle length max_length. Along with this I want to make a histogram of the number of cycles (per ...
0 votes
1 answer
296 views
Finding cycles in an undirected graph in [node, node] format returns wrong result
I'm trying to find cycles in an undirected, unweighted graph. In [node, node] format. Here is the code I wrote: def find_cycles(graph): cycles = [] def dfs(node, visited, path): ...
1 vote
1 answer
194 views
Cycle Detection in Undirected Graph [closed]
I have this undirected and weighted graph in the above link and I just cannot detect how many cycles are there. I have tried BFS, DFS and Set disjoint method but all of them just goes wrong somewhere ...
0 votes
1 answer
83 views
Finding cyclic product relations with TypeORM/SQL/NestJS
Currently I have a Product class like so: @Entity() export class Product { @PrimaryGeneratedColumn() id: number; @ManyToMany(() => Product, (product) => product.id, { onDelete: '...
0 votes
0 answers
238 views
How to to check the cycles count in time series data using Python
I have a battery voltage data with respect to Datetime, collected data for one month I need to find out the number of cycles of battery hers is my data https://docs.google.com/spreadsheets/d/...
2 votes
1 answer
161 views
Getting wrong answer for simple algorithm with cycle detection
I am solving this problem, a part of the problem that is giving me troubles is formulated as follows: a. Start from index i=0; b. Jump to index i=A[i]; c. If the current index i is outside the valid ...
0 votes
1 answer
98 views
In course schedule II : Leetcode, how can we ensure when there are multiple answers the solution is the one with increasing order of course number?
When there are multiple solutions, I want to return the solution where courses are in ascending order. How can I do that by the topological sort algorithm?