Graph.agda 376 B

1234567891011121314151617181920
  1. module Graph (Node : Set) where
  2. open import Basics
  3. data Edge : Set where
  4. edge : Node -> Node -> Edge
  5. Graph : Set
  6. Graph = List Edge
  7. Step : Graph -> Node -> Node -> Set
  8. Step G x y = Elem (edge x y) G
  9. infixr 40 _<>_
  10. data Path (G : Graph) : Node -> Node -> Set where
  11. nul : forall {x} -> Path G x x
  12. _<>_ : forall {x y z} -> Step G x y -> Path G y z -> Path G x z