1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
use crate::;
/// Computes the global clustering coefficient of a graph. The global clustering coefficient is
/// defined as the number of triangles in the graph divided by the number of triplets in the graph.
///
/// # Arguments
///
/// - `g` - A reference to the graph
///
/// # Returns
///
/// The global clustering coefficient of the graph
///
/// # Example
///
/// ```rust
/// use raphtory::algorithms::metrics::clustering_coefficient::global_clustering_coefficient::global_clustering_coefficient;
/// use raphtory::prelude::*;
/// let graph = Graph::new();
/// let edges = vec![
/// (1, 2),
/// (1, 3),
/// (1, 4),
/// (2, 1),
/// (2, 6),
/// (2, 7),
/// ];
/// for (src, dst) in edges {
/// graph.add_edge(0, src, dst, NO_PROPS, None).expect("Unable to add edge");
/// }
/// let results = global_clustering_coefficient(&graph.at(1));
/// println!("global_clustering_coefficient: {}", results);
/// ```
///