Re: Persistant graphs

From: Bill Spight (bspight_at_pacXbell.net)
Date: 10/06/04


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



Relevant Pages

  • Re: Persistant graphs
    ... >> I'd like to do some graph rewriting in Prolog, ... >> backtrack to the original graph and attempt a different rewrite. ... > along with their immediate successors. ...
    (comp.lang.prolog)
  • Re: Can I measure how much memory an object consumes?
    ... to calculate or measure how much memory these 100 request objects will ... which parts of the graph do you want to recurse?". ... the CLOS instance ... and its data vector separately, ...
    (comp.lang.lisp)
  • Re: How do I get Graph to be "within" Word?
    ... Go to the Memory pane and raise Word's Preferred memory to ... Add a little bit more RAM to the preferred RAM setting for Word in ... >> I did exactly as you said and NOW I CAN EDIT GRAPHS! ... >> graph, place it, work on other graphs, but then when I go back to edit ...
    (microsoft.public.mac.office.word)
  • Tracking memory usage and object life time.
    ... I have programmed some python script that loads a graph (the ... memory usage of Python in top, I see it starts out with around 80 MB ...
    (comp.lang.python)
  • Re: Larry Wall, on Tcl
    ... If DAG means Directed Acyclic Graph, ... Yes, your are right the object graph isn't a DAG, ... "When the garbage collector starts running, ... thinking about memory allocation and cleanup. ...
    (comp.lang.tcl)