Questions tagged [cyclic-graph]

55 questions
3
votes
0 answers

Memoizing traversal over a cyclic graph

I have a directed graph that is cyclic in general, and I want to find relationships between nodes and sinks. Traversals over directed graphs seem to be well-suited for memoization with recursion, since the graph can be mapped to the results of the…
concat
  • 3,107
  • 16
  • 30
3
votes
2 answers

How to handle a path in Prolog graph traversal

I have written in Prolog: edge(x, y). edge(y, t). edge(t, z). edge(y, z). edge(x, z). edge(z, x). path(Start, End, Path) :- path3(Start, End, [Start], Path). path3(End, End, RPath, Path) :- reverse(RPath, Path). path3(A,B,Path,[B|Path]) :- …
aragorn ara
  • 165
  • 3
  • 14
3
votes
2 answers

Prolog graph path search with cyclic path

I am a complete newbie in Prolog. I am trying to figure out a problem where I need to check if path is present between edges. I am done with acyclic graph code for cyclic my code is going to infinite loop. path(Start, End) :- edge(Start,…
3
votes
3 answers

Finding the list of common children (descendants) for any two nodes in a cyclic graph

I have a cyclic directed graph and I was wondering if there is any algorithm (preferably an optimum one) to make a list of common descendants between any two nodes? Something almost opposite of what Lowest Common Ancestor (LCA) does.
user3684042
  • 651
  • 2
  • 6
  • 16
3
votes
1 answer

Defining a graph node variant with cycles in OCaml

I am trying to implement a regex to NFA converter. I have most of the code written, but I am struggling to find a way to build a graph with a cycle given my representation for states (nodes) and edges. My graph representation is as follows: type…
3
votes
2 answers

couting back edges to get the number of cylces in a directed graph

I have been writing code to get all the possible cycles in a directed graph. Here is an implementation that keeps track of back edges and whenever one back edge is found, it return true that one cycle is detected. I extended this to the…
eagertoLearn
  • 9,772
  • 23
  • 80
  • 122
3
votes
1 answer

Enumerate first 2^20 paths which don't include cycles between two vertixes

Input is an undirected, cyclic, planar graph, with each vertex having at most 8 edges. What is the way to enumerate over all paths betwen two vertexes v_0, v_1 in an order from shortest to longest? What is computational complexity? If above is not…
Paweł Szczur
  • 5,484
  • 3
  • 29
  • 32
2
votes
1 answer

Difference between a directed cycle and a strongly connected component

I have this graph. The SCCs in this Graph are {a, b, e}, {d, g}, and {c, d, h}. But the cycles in this graph are the same components, right? So what exactly is the difference between SCCs and directed cycles? Do they only differ in specific cases?
2
votes
2 answers

Remove cycles from connected graph by finding vertices and edges

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…
Bob Billy
  • 285
  • 1
  • 6
2
votes
3 answers

Is backtracking absolutely necessary for cycle detection using DFS in directed graph?

I came across this SO post where it is suggested that cycle detection using DFS in a directed graph is faster because of backtracking. Here I quote from that link: Depth first search is more memory efficient than breadth first search as you can…
2
votes
1 answer

JUNG Cyclic Tree Layout

I would like to visualise a graph (which is not a tree) in JUNG, using the tree layout. I understand that that may seem a bit odd, but the thing is the following. The application is backed by a Neo4J database. There are a bunch of nodes in them, all…
Pieter-Jan
  • 1,675
  • 2
  • 19
  • 25
1
vote
1 answer

minimum collection of vertice disjoint path that covers a given vertice set

Problem Given: A directed graph G A source vertex s in G and a target vertex t in G A set S of vertices of G I want to find a collection of paths from s to t that covers S. Then I want to partition the collection of paths into subcollections of…
1
vote
1 answer

Dijkstra's algorithm for directed graph with positive weights and a cycle

If I have a directed graph with a cycle and only positive weights, and instead of using Priority Queue, I use a queue and keep adding all children, including those that were visited because I choose not to track the visited, can my algo fall in…
1
vote
0 answers

Finding All Bounded-Length Simple Cycles in a Directed Graph

I'm looking for the implementation of any fast algorithm that finds all bounded-length simple cycles in a Directed Graph. I've tried to find all simple cycles without length constraint using java jgrapht library and then filter them, but it's very…
1
vote
1 answer

With multiple cycles between 2 nodes

Trying to find all cycles in a directed graph, via DFS. But got an issue. Issue When there are multiple cycles between 2 nodes, sometimes only the longest one can be detected, the shorter one is skipped. This is due to when a node is visited, I…
Eric
  • 22,183
  • 20
  • 145
  • 196