content: ------------- Examen Aout B Haskell -----------
  
  graphe = Graph [1,2,3,4,5,6,7,8,9] [(1,2), (2,3), (1,4), (1,5), (3,7), (7,5), (4,3), (5,6), (8,9), (9,8)]
  
  
  --- Graphe ---
  data Graph = Graph [Node] [Edge]
  type Node = Int
  type Edge = (Int, Int)
  
  --- Fonctions --
  suppDoublon :: Eq a => [a] -> [a]
  suppDoublon [] = []
  suppDoublon (x:xs) = x:suppDoublon (filter (/= x) xs)
  
  nodesReachable :: Graph -> Node -> [Node]
  nodesReachable (Graph nodes edges) node = suppDoublon $ foldl (\acc elem -> if fst elem == node then (snd elem):(nodesReachable (Graph nodes (filter (/= elem) edges)) (snd elem)) ++ acc else acc) [] edges
  
  isCyclic :: Graph -> Bool
  isCyclic (Graph nodes edges) = foldl (\acc node -> elem node (nodesReachable (Graph nodes edges) node) || acc) False nodes
  
  bidirectionnalGraph :: Graph -> Graph
  bidirectionnalGraph (Graph nodes edges) = Graph nodes (foldl (\acc elem -> (snd elem, fst elem):elem:acc) [] edges)
  
  
  isConnected :: Graph -> Bool
  isConnected (Graph (x:xs) edges) = length (nodesReachable (bidirectionnalGraph (Graph (x:xs) edges)) x) == length (x:xs)
  
  