<commit_before><?php

spl_autoload_register(function($class){
    require_once(__DIR__.'/'.str_replace('_','/',$class).'.php');
});

$interface = new main();

class main{
	
	/**
	 * 
	 * @var Graph
	 */
	private $graph = NULL;
	
	private function getFiles() {
		$files = array();
		$dir = openDir("data");
		$i = 0;
		while ($file = readDir($dir)) {
			if ($file != "." && $file != "..") {
				$files[$i] = $file;
				++$i;
			}
		}
		closeDir($dir);
		
		return $files;
	}
	
	public function __construct(){
		echo "Read Graph-File:\n\n";
		
		$this->readFile();
		
		echo "\n";
		
		while(true){
			$this->chooseAction();
			
			echo "\n";
		}
	}
	
	private function readFile(){
		$fileFormatRightInput = false;
		$fileNameRightInput = false;
		
		$fileFormat = NULL;
		$fileName = NULL;
		
		while($fileFormatRightInput == false)
		{
			echo "What kind of File you want to read?\n";
			echo "0 = Adjacency matrix\n";
			echo "1 = Edge list\n";
			echo "2 = Create complete graph\n";
		
			fscanf(STDIN, "%d\n", $fileFormat);
		
			switch ($fileFormat){
				case 0:
				case 1:
				case 2:
					$fileFormatRightInput = true;
			}
		}
		
		while($fileNameRightInput == false)
		{
			echo "Please enter the file name?\n";
		
			fscanf(STDIN, "%s\n", $fileName);
			
			$fileNameRightInput = true;
		}
		
		switch ($fileFormat){
			case 0:
				$loaderAdjacencyMatrix = new LoaderAdjacencyMatrix();
				$loaderAdjacencyMatrix->setFileName($fileName);
				$this->graph = $loaderAdjacencyMatrix->getGraph();
				$rightInput = true;
				break;
			case 1:
				$interface = new LoaderEdgeList();
				$interface->setFileName($fileName);
				$this->graph = $interface->getGraph();
				$rightInput = true;
				break;
			case 2:
				$interface = new LoaderCompleteGraph($fileName);
				$this->graph = $interface->getGraph();
				$rightInput = true;
				break;
		}
	}

	private function chooseAction(){
		$chooseOption = false;
		
		while($chooseOption == false)
		{
			echo "What do you want to do?\n";
			echo "0 = breadth-first search\n";
			echo "1 = depth-first search\n";
			echo "2 = components of graph\n";
		
			fscanf(STDIN, "%d\n", $option);
		<commit_msg>fixed create of complete graph<commit_after><?php

spl_autoload_register(function($class){
    require_once(__DIR__.'/'.str_replace('_','/',$class).'.php');
});

$interface = new main();

class main{
	
	/**
	 * 
	 * @var Graph
	 */
	private $graph = NULL;
	
	private function getFiles() {
		$files = array();
		$dir = openDir("data");
		$i = 0;
		while ($file = readDir($dir)) {
			if ($file != "." && $file != "..") {
				$files[$i] = $file;
				++$i;
			}
		}
		closeDir($dir);
		
		return $files;
	}
	
	public function __construct(){
		echo "Read Graph-File:\n\n";
		
		$this->readFile();
		
		echo "\n";
		
		while(true){
			$this->chooseAction();
			
			echo "\n";
		}
	}
	
	private function readFile(){
		$fileFormatRightInput = false;
		$fileNameRightInput = false;
		
		$fileFormat = NULL;
		$fileName = NULL;
		
		while($fileFormatRightInput == false)
		{
			echo "What kind of File you want to read?\n";
			echo "0 = Adjacency matrix\n";
			echo "1 = Edge list\n";
			echo "2 = Create complete graph\n";
		
			fscanf(STDIN, "%d\n", $fileFormat);
		
			switch ($fileFormat){
				case 0:
				case 1:
				case 2:
					$fileFormatRightInput = true;
			}
		}
		
		while($fileNameRightInput == false)
		{
			echo "Please enter the file name?\n";
		
			fscanf(STDIN, "%s\n", $fileName);
			
			$fileNameRightInput = true;
		}
		
		switch ($fileFormat){
			case 0:
				$loaderAdjacencyMatrix = new LoaderAdjacencyMatrix();
				$loaderAdjacencyMatrix->setFileName($fileName);
				$this->graph = $loaderAdjacencyMatrix->getGraph();
				$rightInput = true;
				break;
			case 1:
				$interface = new LoaderEdgeList();
				$interface->setFileName($fileName);
				$this->graph = $interface->getGraph();
				$rightInput = true;
				break;
			case 2:
				$interface = new LoaderCompleteGraph();
				$interface->setNumverOfVertices($fileName);
				$this->graph = $interface->getGraph();
				$rightInput = true;
				break;
		}
	}

	private function chooseAction(){
		$chooseOption = false;
		
		while($chooseOption == false)
		{
			echo "What do you want to do?\n";
			echo "0 = breadth-first search\n";
			echo "1 = depth-first search\n";
			echo "2 = components of graph\n";
		
			fscanf(STDIN, "%d\n", $option);
		
{'fraction_non_alphanumeric': 0.1681943171402383, 'fraction_numerical': 0.005957836846929423, 'mean_word_length': 2.914798206278027, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 24, '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': '6128146', 'n_tokens_mistral': 1904, 'n_tokens_neox': 1501, 'n_words': 349}