# sf.apps.similarity.prob_event_exact¶

prob_event_exact(graph, photon_number, max_count_per_mode, n_mean=5, loss=0.0)[source]

Gives the exact probability of a given event for the input graph.

Events are made up of multiple orbits. To calculate an event probability, we can sum over the probabilities of its constituent orbits using prob_orbit_exact().

Example usage:

>>> graph = nx.complete_graph(8)
>>> prob_event_exact(graph, 4, 2)
0.11077180648422322

Parameters
• graph (nx.Graph) – input graph encoded in the GBS device

• photon_number (int) – number of photons in the event

• max_count_per_mode (int) – maximum number of photons per mode in the event

• n_mean (float) – total mean photon number of the GBS device

• loss (float) – fraction of photons lost in GBS

Returns

exact event probability

Return type

float