Re: Persistant graphs
From: Bill Spight (bspight_at_pacXbell.net)
Date: 10/06/04
- Next message: Carlo Capelli: "Re: http_open in swi-prolog"
- Previous message: projectshave_at_yahoo.com: "Persistant graphs"
- In reply to: projectshave_at_yahoo.com: "Persistant graphs"
- Next in thread: Jan Wielemaker: "Re: Persistant graphs"
- Reply: Jan Wielemaker: "Re: Persistant graphs"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 06 Oct 2004 00:13:27 GMT
projectshave@yahoo.com wrote:
>
> I'd like to do some graph rewriting in Prolog, which will involve lots
> of addition/deletion of nodes and edges. If a rewrite "fails", it must
> backtrack to the original graph and attempt a different rewrite. A
> persistant, or functional, graph would work best in this case. Is
> there a library for persistant graphs available for Prolog somewhere?
> I'm hoping to avoid the assert/retract global space.
>
Make the graphs terms and carry along the different versions of the
graph being rewritten as arguments. Do not use assert and retract. That
may take a lot of memory, but memory is cheap these days.
For instance, you might represent the graph as a list of nodes
(vertices) along with their immediate successors. Like so:
Graph = [Node - Successors | Nodes]
Then you might have a predicate
rewrite(Graph0, Graph) :- ....
Best wishes,
Bill
- Next message: Carlo Capelli: "Re: http_open in swi-prolog"
- Previous message: projectshave_at_yahoo.com: "Persistant graphs"
- In reply to: projectshave_at_yahoo.com: "Persistant graphs"
- Next in thread: Jan Wielemaker: "Re: Persistant graphs"
- Reply: Jan Wielemaker: "Re: Persistant graphs"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|