def parseLink(link, weighted):
	"""Parse single link in Pajek format
	link  - string in the format: <src_id> <dst_id> [<weight>]
	weighted  - wether to consider weight

	return (dest_id, weight)
	"""
	link = link.split()
	if not link or len(link) > 2:
		raise ValueError(' '.join(('Invalid format of the link specification:', link)))
	weight = None
	if weighted and len(link) > 1:
		weight = link[1]
	return (link[0], weight)