Questions tagged [transitive-closure]

Use this tag for the transitive closure of a relationship or when related to graph theory.

References:

Wikipedia
Wolfram MathWorld

148 questions
0
votes
0 answers

Arguments not sufficiently instantiated in Prolog error

As the title suggests, I am having an error I don't really know how to fix as I am quite new to prolog and was wondering if someone could point out a solution? I wrote some code to find paths between certain points. Here is my…
0
votes
0 answers

Finding Paths in Prolog

I'm relatively new to Prolog and my aim from this code is to try and find all routes between all defined edges. Prolog should output me the full route from the inputted start to destination. However I keep getting an error bash: -c: line 1: syntax…
0
votes
1 answer

Prolog, give a path from point x to the goal

This is my code: % A The first link as a predicate link(1,2). link(2,3). link(3,4). link(3,6). link(6,7). link(6,5). So what we did with the path predicate is check from a given starting point check if there exists a path from that point to the…
Rajivrocks
  • 141
  • 2
  • 13
0
votes
0 answers

How to get transitive closure for all dependencies of vscode itself?

Greetings, This question is about vscode itself, the Microsoft build. I would like to know all the dependencies it does have, recursively until I hit the transitive closure. I also need to know the version/license of each one of these dependencies.…
0
votes
1 answer

DCG chain from facts, including "not seen before" condition

I am trying to solve the traditional path-finding puzzle using DCG notation. These are some connected numbers, and they make a chain from start to end. You can step between two numbers if there is a connection one way or the other, as normal. For…
TessellatingHeckler
  • 27,511
  • 4
  • 48
  • 87
0
votes
1 answer

JQ, convert CSV (parent child format) to JSON, another questions

This is a continue of another post: JQ, convert CSV (parent child format) to JSON Hi, sorry to ask again. I tried to get the following format, without success. Really appreciate for some advice. I attach a picture to show how it looks like in a…
Lee
  • 1
0
votes
1 answer

How can I fix my code to avoid returning duplicate pairs while using map in racket?

This function should return the transitive closure of L. For Examples: (Transitive-Closure'((a b) (b c) (a c))) ---> '((a b) (b c) (a c)) (Transitive-Closure'((a a) (b b) (c c))) ---> '((a a) (b b) (c c)) (Transitive-Closure'((a b) (b a))) --->…
0
votes
1 answer

Prolog beginner ERROR: Out of local stack

I am very new to Prolog programming. Any help is greatly appreciated. I have the following program, bigger(elephant, horse). bigger(horse, donkey). bigger(donkey, dog). bigger(donkey, monkey). is_bigger(X, Y) :- bigger(X, Y). is_bigger(X, Y) :-…
0
votes
1 answer

Recursive CTE / transitive closure in pandas

My scenario: User A is (fraudster). User B is not (fraudster). However, the system will not allow user B to do any action. Because B and A are using the same Phone Number(Shared attribute with Fraud User). (1 layer). User D is not (fraudster). But…
0
votes
1 answer

Why does this transitive closure of z3 produce different results?

I am running the following program about transitive closure of z3: from z3 import * def main(): A = DeclareSort('A') R = Function('R', A, A, BoolSort()) TC_R = TransitiveClosure(R) # TRC_R = TransitiveReflexiveClosure(R) s =…
windkl
  • 13
  • 4
0
votes
1 answer

How to find a route between two stations in PROLOG

Sorry, I know this question comes up a lot but I've done so much research and I just can't figure out how to solve this problem. I have represented a tube map in PROLOG and need to write a predicate that returns all routes between two stations. I…
user13062663
0
votes
0 answers

example of a for-while loop to go from a list of nodes to a reachability matrix or a graph of transitively associated nodes and edges?

I'm a beginner! I'm trying to code a for-while loop using Twint to scrape Twitter, starting from a list or a dict of usernames and ending up with a (NetworkX) directed graph of transitively associated nodes and edges. I want to set a variable number…
KesterR
  • 1
  • 1
0
votes
0 answers

How to implement the relationship for any two representatives located in different parts of the database?

Task: Create a database query that gives a hierarchical relationship for any two representatives of the genus, in other words, find out who is the ancestor and who is the descendant. Database: parent('Rurik', 'Igor'). parent('Igor',…
GOOse
  • 13
  • 2
0
votes
1 answer

Prolog - Predicate To Detect Connected Nodes In a Directed Graph

I was looking at this question, in which we make a predicate in Prolog which finds a path between two nodes ("metro stations") in a directed graph. The original code suggested is the following path(Start, Dest, [[Start,Dest]]) :- connected(Start,…
Theorem
  • 105
  • 4
0
votes
1 answer

Why do i get a stack limit exceeded error when defining a predicate that convert the relation of two atoms?

I want to know why does the program goes in an infinite recursion in those cases: ?- love(kay, amanda). and ?- love(rob, amanda). And here is the code: love(amanda, kay). love(kay, geo). love(geo, rob). love(X, Y) :- love(X, Z), love(Z,…