Różnice

Różnice między wybraną wersją a wersją aktualną.

Odnośnik do tego porównania

pl:prolog:pllib:graph_connections [2019/06/27 15:50]
pl:prolog:pllib:graph_connections [2019/06/27 15:50] (aktualna)
Linia 1: Linia 1:
 +====== Graph connections ======
 +{{tag>​graphs}}
 +===== Description =====
 +Connectivity in a graph.
 +
 +**Source**: ​ The Art of Prolog
 +===== Download =====
 +Program source code: {{graph_connections.pl}}
 +===== Listing =====
 +<code prolog>
 +/*
 +   ​connected(X,​Y) :-
 + Node X is connected to node Y in the graph defined by edge/2.
 +*/
 +
 +     ​connected(X,​Y) :- connected(X,​Y,​[X]).
 +
 +     ​connected(X,​X,​Visited).
 +     ​connected(X,​Y,​Visited) :- 
 + edge(X,​N),​ not member(N,​Visited),​ connected(N,​Y,​[N|Visited]).
 +
 +% Program 14.10: Connectivity in a graph
 +</​code>​
 +===== Comments =====
  
pl/prolog/pllib/graph_connections.txt · ostatnio zmienione: 2019/06/27 15:50 (edycja zewnętrzna)
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0