Skip to content

Instantly share code, notes, and snippets.

@fritz0705
Created October 6, 2012 20:11
Show Gist options
  • Select an option

  • Save fritz0705/3845965 to your computer and use it in GitHub Desktop.

Select an option

Save fritz0705/3845965 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
# coding: utf-8
import sys
peerings = []
print("graph dn42 {")
for line in sys.stdin:
_as = line.split(" ")[:-1]
i = 0
while i < len(_as) - 1:
if _as[i] != _as[i+1] and (_as[i], _as[i+1]) not in peerings:
peerings.append((_as[i], _as[i+1]))
print("{0} -- {1};".format(_as[i], _as[i+1]))
i += 1
print("}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment