Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8643263
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:59:25+00:00 2026-06-12T11:59:25+00:00

I want to do a graph search with JIProlog. The below example works fine

  • 0

I want to do a graph search with JIProlog. The below example works fine without the memberchk, but then it returns paths with cycles, which I don’t want. When I do include it, however, Prolog freezes, probably because of the infinite search.

connected(ac,a,b). connected(ac,a,c). connected(ac,b,c). 
connected(ac,b,a). connected(ac,c,a). connected(ac,c,b).

path(A,B,[AB]) :- connected(AB,A,B).
path(A,C,[H|T]) :- connected(H,A,B), path(B,C,T), \+ memberchk(H,T).

In this answer I found why (the list of edges is not yet instantiated) and a hint to a solution (using freeze/2). However, freeze/2 doesn’t work in JIProlog, which is what I’m using. Can anyone help me to an alternative solution?

Edit: I know for graphs in general it would be a solution to keep track of nodes instead, such as in this example, but for my particular application the “nodes” can also be on an edge, which is why I want to check for edges that were visited rather than nodes that were visited.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T11:59:26+00:00Added an answer on June 12, 2026 at 11:59 am

    I’m not sure to understand your requirement. I would try to adapt the suggested answer.

    % get a path from start to end
    path(Start, End, Path) :-
        path(Start, End, [], Path).
    
    path(A, B, Visited, [AB|Visited]) :- connected(AB, A, B).
    
    path(A, C, Visited, Path) :-
        connected(AB, A, B),
        \+ memberchk(AB, Visited),
        path(B, C, [AB|Visited], Path).
    

    beware: untested code….

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to give my graph a title in big 18pt font, then a
As the title says i want to search with Facebook Api (Graph Api or
I want to build a mySQL query, which returns all nodes in a graph
I want to use the Facebook Graph API to search for exact page matches
I want to graph from one date to another date and i only partial
I want to generate graph from my database data can anyone tell me about
I want to draw graph in java script. Let me share my problem with
I want to create a graph in Excel with the spreadsheet reference. @model IEnumerable<ARTex.Core.Models.Reservation>
I want to draw a graph in my Django-based site, to look like these
I want to generate a graph with a large decimal number like -106.63633167743683 or

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.