# Examples¶

Compute a distance between two graphs.

See Distance between two graphs.

<<<

```
import copy
from mlstatpy.graph import GraphDistance
# We define two graphs as list of edges.
graph1 = [("a", "b"), ("b", "c"), ("b", "X"), ("X", "c"),
("c", "d"), ("d", "e"), ("0", "b")]
graph2 = [("a", "b"), ("b", "c"), ("b", "X"), ("X", "c"),
("c", "t"), ("t", "d"), ("d", "e"), ("d", "g")]
# We convert them into objects GraphDistance.
graph1 = GraphDistance(graph1)
graph2 = GraphDistance(graph2)
distance, graph = graph1.distance_matching_graphs_paths(graph2, use_min=False)
print("distance", distance)
print("common paths:", graph)
```

>>>

```
distance 0.3318250377073907
common paths: 0
X
a
b
c
d
e
00
11
g
t
a -> b []
b -> c []
b -> X []
X -> c []
c -> d []
d -> e []
0 -> b []
00 -> a []
00 -> 0 []
e -> 11 []
c -> 2a.t []
2a.t -> d []
d -> 2a.g []
2a.g -> 11 []
```

(entrée originale : graph_distance.py:docstring of mlstatpy.graph.graph_distance.GraphDistance, line 3)