array('6V.wisA/TP1', '6V.wisC/TP1'), '5H.kualg/TP1' => array('5H.kumu/TP1', '5H.kubv/TP1')) ); //array('5H.schk/TP1', '6V.wisD/TP1'), */ $db = mdb2_open($dsn); $herinfo = get_better_herinfo($db, $_GET); //if (isset($_GET['period_id'])) { // $herinfo = get_herinfo($db, $_GET['period_id']); //} else { // $herinfo = get_herinfo($db); //} $period_id = $herinfo['period_id']; //$buiten_beschouwing = array( // '5H.netl/TP2 ST lit', // '6V.netl/TP2 ST literatuur', //); $buiten_beschouwing = get_buiten_beschouwing($db, $period_id); $samenvoegen = get_samenvoegen($db, $herinfo['period_id']); //$samenvoegen = array( // '5V.wisAC/TP2 ST1' => array('5V.wisA/TP2 ST1', '5V.wisC/TP2 ST1'), // '6V.wisAC/TP2 ST3' => array('6V.wisA/TP2 ST3', '6V.wisC/TP2 ST3'), //); if (isset($_GET['limit'])) $toetsen = get_toetsen_from_db($db, $period_id, $buiten_beschouwing, $samenvoegen, $_GET['limit']); else $toetsen = get_toetsen_from_db($db, $period_id, $buiten_beschouwing, $samenvoegen); function set_graph_id(&$toets, $id) { global $toetsen, $collections; assert(!$toets['graph']); $toets['graph'] = $id; foreach ($toets['neighbors'] as $naam => $aantal) { if ($toetsen[$naam]['graph'] === NULL) { $collections[$id]['list'][] = $naam; set_graph_id($toetsen[$naam], $id); } } } $graph_id = 0; $collections = array(); $collections[0] = array('list' => array()); foreach ($toetsen as $naam => &$value) { //if ($value['graph'] !== NULL) continue; //$collections[$graph_id] = array('list' => array($naam)); //set_graph_id($value, $graph_id++); // $value['graph'] = 0; $collections[0]['list'][] = $naam; } unset($value); //echo("aantal onafhankelijke sets: $graph_id\n"); function get_bad_colors(&$toetsen, &$c, $no, $max_colors, $add_undefined = false) { $bad_colors = array(); for ($i = 0; $i < $max_colors; $i++) $bad_colors[] = 0; if ($add_undefined) $bad_colors[NULL] = 0; // alle vertices met een lagere index zijn al gekleurd // en alle vertices met een hogere index zijn niet gekleurd // // visit all colored neighbors foreach ($toetsen[$c['list'][$no]]['neighbors'] as $neighbor => $count) { if ($c['indices'][$neighbor] > $no && !$add_undefined) break; $bad_colors[$toetsen[$neighbor]['color']]++; } return $bad_colors; } $max_max_colors = 1; $dot = dot($collections[0]['list'], $toetsen); $collections[0]['filename'] = $svg_filename = $datadir.md5($dot).'.svg'; if (!file_exists($svg_filename)) { $dot_filename = tempnam(sys_get_temp_dir(), 'her'); //if (file_put_contents($datadir.md5($dot).'.dot', $dot) === FALSE) error_system('unable to write .dot file'); if (file_put_contents($dot_filename, $dot) === FALSE) error_system('unable to write .dot file'); $out = system("dot -Tsvg -o$svg_filename $dot_filename", $ret); if ($ret != 0) error_system("error $ret creating .svg from .dot: $out"); unlink($dot_filename); } for ($next = 1; $next < 6; $next++) { $collections[$next] = array('list' => array()); /* verwijder toetsen met 'weinig' neighbors */ foreach ($collections[$next-1]['list'] as $naam) { if (count($toetsen[$naam]['neighbors']) >= $next) { $collections[$next]['list'][] = $naam; } } /* haal verwijderde toetsen uit neighbors */ foreach ($collections[$next]['list'] as $naam) { foreach ($toetsen[$naam]['neighbors'] as $neighbor => $count) { if (!in_array($neighbor, $collections[$next]['list'])) { // echo("hoihoi $neighbor"); unset($toetsen[$naam]['neighbors'][$neighbor]); } } } do { $remove = 0; foreach ($collections[$next]['list'] as $id => $naam) { if (count($toetsen[$naam]['neighbors']) < $next) { $remove += 1; unset($collections[$next]['list'][$id]); } } /* haal verwijderde toetsen uit neighbors */ foreach ($collections[$next]['list'] as $naam) { foreach ($toetsen[$naam]['neighbors'] as $neighbor => $count) { if (!in_array($neighbor, $collections[$next]['list'])) { unset($toetsen[$naam]['neighbors'][$neighbor]); } } } } while ($remove); $dot = dot($collections[$next]['list'], $toetsen); $collections[$next]['filename'] = $svg_filename = $datadir.md5($dot).'.svg'; if (!file_exists($svg_filename)) { $dot_filename = tempnam(sys_get_temp_dir(), 'her'); //if (file_put_contents($datadir.md5($dot).'.dot', $dot) === FALSE) error_system('unable to write .dot file'); if (file_put_contents($dot_filename, $dot) === FALSE) error_system('unable to write .dot file'); $out = system("dot -Tsvg -o$svg_filename $dot_filename", $ret); if ($ret != 0) error_system("error $ret creating .svg from .dot: $out"); unlink($dot_filename); } ?>

ST's die buiten beschouwing zijn gelaten:


ST's die gekoppeld zijn:


De roostergraaf gaat ervan uit dat elke toetsduur bij elke kleur kan worden afgenomen

test node_A 100 minuten node_B 50 minuten node_C 80 minuten node_D 40 minuten node_E 150 minuten node_F ? minuten $collection) { if ($aantal == 0) { echo("

Graaf met alle toetsen

\n"); } else { echo("

Graaf met $aantal kleur(en)

\n"); } ?>