parse connections into segments