<commit_before>import re
from pprint import pprint
from graphutils import Vertex, Queue

class Graph:
	def __init__(self, directed=True):
		self.edges = {}
		self.vertex_id_to_object = {}
		self.dfs_time = 0
		self.directed = directed
		# self.count = 0
	
	def insertEdge(self, v1, v2):
		if not self.vertex_id_to_object.has_key(v1):
			self.vertex_id_to_object[v1] = Vertex(v1)
		if not self.vertex_id_to_object.has_key(v2):
			self.vertex_id_to_object[v2] = Vertex(v2)
		# self.edges[v1] = append(v2)
		if self.edges.has_key(v1):
			self.edges[v1].append(v2)
			if not self.directed:
				if self.edges.has_key(v2):
					self.edges[v2].append(v1)
				else:
					self.edges[v2] = [v1]
			else:
				self.edges[v2] = []
		else:
			# print self.edges
			self.edges[v1] = [v2]
		# print self.edges['gandalf']
		
	def readFile(self, filename):
		lines = open(filename, 'r').read().split('\r\n')
		# print lines
		for line in lines:
			words = re.split('\t', line)
			# print words
			self.insertEdge(words[0], words[1])

	def dfs_visit(self, start):
		
		self.dfs_time += 1
		print "Currently at ", start<commit_msg>Added a few extra comments.<commit_after>import re
from pprint import pprint
from graphutils import Vertex, Queue

class Graph:
	def __init__(self, directed=True):
		self.edges = {}
		self.vertex_id_to_object = {}
		self.dfs_time = 0
		self.directed = directed
		# self.count = 0
	
	def insertEdge(self, v1, v2):
		if not self.vertex_id_to_object.has_key(v1):
			self.vertex_id_to_object[v1] = Vertex(v1)
		if not self.vertex_id_to_object.has_key(v2):
			self.vertex_id_to_object[v2] = Vertex(v2)
		# self.edges[v1] = append(v2)
		if self.edges.has_key(v1):
			self.edges[v1].append(v2)
			if not self.directed:
				if self.edges.has_key(v2):
					self.edges[v2].append(v1)
				else:
					self.edges[v2] = [v1]
			else:
				self.edges[v2] = []
		else:
			# print self.edges
			self.edges[v1] = [v2]
		# print self.edges['gandalf']
		
	def readFile(self, filename):
		lines = open(filename, 'r').read().split('\r\n')
		# print lines
		for line in lines:
			words = re.split('\t', line)
			# print words
			self.insertEdge(words[0], words[1])

	def dfs_visit(self, start):
		#actual recursive dfs
		self.dfs_time += 1
		print "Currently at ", start
{'fraction_non_alphanumeric': 0.1435533894550288, 'fraction_numerical': 0.02303943287549845, 'mean_word_length': 3.5524193548387095, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6084505', 'n_tokens_mistral': 1031, 'n_tokens_neox': 901, 'n_words': 184}