Skip to content

Instantly share code, notes, and snippets.

@MLWhiz
Created January 20, 2019 18:01
Show Gist options
  • Save MLWhiz/7a2b214a074323e699ffab0dd60c5b57 to your computer and use it in GitHub Desktop.
Save MLWhiz/7a2b214a074323e699ffab0dd60c5b57 to your computer and use it in GitHub Desktop.
g = {'Frankfurt': {'Mannheim':85, 'Wurzburg':217, 'Kassel':173},
'Mannheim': {'Frankfurt':85, 'Karlsruhe':80},
'Karlsruhe': {'Augsburg':250, 'Mannheim':80},
'Augsburg': {'Karlsruhe':250, 'Munchen':84},
'Wurzburg': {'Erfurt':186, 'Numberg':103,'Frankfurt':217},
'Erfurt': {'Wurzburg':186},
'Numberg': {'Wurzburg':103, 'Stuttgart':183,'Munchen':167},
'Munchen': {'Numberg':167, 'Augsburg':84,'Kassel':502},
'Kassel': {'Frankfurt':173, 'Munchen':502},
'Stuttgart': {'Numberg':183}
}
graph = Graph(g)
print("Vertices of graph:")
print(graph.vertices())
print("Edges of graph:")
print(graph.edges())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment