0
您好所有我有一個問題序言無向圖線發出
我有一個圖形非定向enter image description here
我所列舉的在節點的形式,各節點(姓名,[路徑])。 其中具有多個路徑的節點是節點(名稱,[路徑名,路徑])。 //然而,可能的路徑與節點相交。
>node(giant,[sizePath]).
>node(large,[sizePath]).
>node(big,[sizePath]).
>node(a0,[numPath,alphabetPath]).
>node(1,[numPath]).
>node(2,[numPath]).
>node(3,[numPath]).
>node(b,[alphabetPath]).
>node(c,[alphabetPath]).
>node(d,[alphabetPath]).
然後我寫了一個規則,說明
samePath(Node1,Node2,PathName):-node(Node1,PathName),node(Node,1PathName).
如果我用值
samePath(2,3,PathName)
我得到的輸出true; numLine.
但是如果我使用的值
samePth(A0,1,PathName)
我應該得到true; numLine.
但是我得到
true; fail.
,因爲它不會只列出兩個列表中匹配的元素
您需要展示整個程序! – false
我做到了,但在這裏再次 – techninja1997