Zulip Chat Archive
Stream: graph theory
Topic: working with explicit graphs
Andrea Nardi (Nov 06 2022 at 15:25):
I am new to Lean,
I wanted to warm myself into graph theory proving by proving simple properties on graphs that I explicitaly made. How can I, in code, make a graph with an e.g. edge list?
Kyle Miller (Nov 06 2022 at 15:29):
Here's an example of an explicit graph in the mathlib archive: https://github.com/leanprover-community/mathlib/blob/master/archive/100-theorems-list/54_konigsberg.lean
Some of the additional definitions (like for vertex degrees) are to help Lean in some arguments by caching results.
Kyle Miller (Nov 06 2022 at 15:31):
I can't find it immediately, but there's another example in this graph theory stream for creating a simple graph using a different representation. There's also an open PR for creating graphs from an edge set.
Andrea Nardi (Nov 06 2022 at 15:41):
Oh great, thanks!
kbridge (Jul 27 2024 at 12:58):
for mathlib4, use https://github.com/leanprover-community/mathlib4/blob/master/Archive/Wiedijk100Theorems/Konigsberg.lean
Last updated: May 02 2025 at 03:31 UTC