Probabilistic graphs

ProbLog can also be used to model probabilistic graphs, i.e., graphs in which the existence of some edges is uncertain. We can use ProbLog2 to calculate, for instance, the probability of there being a path between two given nodes.

digraph probabilistic_graph { rankdir=LR; 1 -> 3 [label="0.1"]; 1 -> 2 [label="0.6"]; 2 -> 5 [label="0.4"]; 2 -> 6 [label="0.3"]; 3 -> 4 [label="0.3"]; 4 -> 5 [label="0.8"]; 5 -> 6 [label="0.2"]; }

The following program illustrates this for a graph with six nodes and seven probabilistic edges. The program uses the regular Prolog definition of path.

0.6::edge(1,2). 0.1::edge(1,3). 0.4::edge(2,5). 0.3::edge(2,6). 0.3::edge(3,4). 0.8::edge(4,5). 0.2::edge(5,6). path(X,Y) :- edge(X,Y). path(X,Y) :- edge(X,Z), Y \== Z, path(Z,Y). query(path(1,5)). query(path(1,6)).

When pressing ‘Evaluate’, ProbLog2 calculates the probability of there being a path from node 1 to 5, and from 1 to 6. We obtain P(path(1,5)) = 0.25824 and P(path(1,6)) = 0.2167296.