# Computing the probability of a path between two nodes in an undirected probabilistic graph
An undirected probabilistic graph is a graph where each edge has a
probability of being present.
Consider the probabilistic graph:
What is the probability that =a= and =e= are connected?
What is the probability that =a= and =e= are connected represented graphically?
We use tabling to avoid non termination:
We declare path/2 as tabled
:- table path/2.
path(X,Y) is true if there is a path between nodes =X= and =Y=
edge(a,b) indicates that there is an edge between =a= and =b=
There is surely a path between a node and itself:
There is surely a path between X and Y if there is another node Z such that
there is a path between X and Z and there is an edge between Z and Y
Edges are undirected
There is an arc between =a= and =b= with probability 0.2:
Other probabilistic arcs:
End of probabilistic part:
Clause for drawing the graph using the integration with Graphviz:
findall(edge(A - B,[label=P,dir=none]),
L. De Raedt, A. Kimmig, and H. Toivonen. ProbLog: A probabilistic Prolog and
its application in link discovery. In International Joint Conference on
Artificial Intelligence, pages 2462-2467, 2007.