Home  |   Notes  |   Languages  |   Programs  |   Homework
DIRECTED GRAPH TESTS

  Test Case 1

?- graph([[a,b],[[a,b],[b,c],[c,a],[b,a],[c,b]]]).

No

?- graph([[a,b,c],[[a,b],[b,c],[c,a],[b,a],[c,b]]]).

Yes

?- assert(defined_graph([[a,b,c],[[a,b],[b,c],[c,a],[b,a],[c,b]]])).

Yes

?- defined_graph(X).

X = [[a,b,c],[[a,b],[b,c],[c,a],[b,a],[c,b]]] ;

No

?- defined_graph(X), node(Y,X).

X = [[a,b,c],[[a,b],[b,c],[c,a],[b,a],[c,b]]]

Y = a ;

X = [[a,b,c],[[a,b],[b,c],[c,a],[b,a],[c,b]]]

Y = b ;

X = [[a,b,c],[[a,b],[b,c],[c,a],[b,a],[c,b]]]

Y = c ;

No

?- defined_graph(X), arc([c,d],X).

No

?- defined_graph(X), arc([c,b],X).

X = [[a,b,c],[[a,b],[b,c],[c,a],[b,a],[c,b]]] ;

No

?- defined_graph(X), path(a,c,X).

Yes

?- defined_graph(X), path(a,c,X,2)

Yes

?- defined_graph(X), path(c,c,X).

Yes

?- defined_graph(X), path(c,d,X).

No

?- defined_graph(X), hascycle(X,3).

Yes


Home  |   Notes  |   Languages  |   Programs  |   Homework

copyright © 2000 Virginia Tech, ALL RIGHTS RESERVED
Last modified: October 30, 2000, 07:55:05 EST, by Lenwood S. Heath <heath@cs.vt.edu>