protected function GraphTest::normalizeGraph in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/tests/Drupal/Tests/Component/Graph/GraphTest.php \Drupal\Tests\Component\Graph\GraphTest::normalizeGraph()
Normalizes a graph.
Parameters
$graph: A graph array processed by \Drupal\Component\Graph\Graph::searchAndSort()
Return value
array The normalized version of a graph.
1 call to GraphTest::normalizeGraph()
- GraphTest::testDepthFirstSearch in core/
tests/ Drupal/ Tests/ Component/ Graph/ GraphTest.php - Test depth-first-search features.
File
- core/
tests/ Drupal/ Tests/ Component/ Graph/ GraphTest.php, line 94 - Contains \Drupal\Tests\Component\Graph\GraphTest.
Class
- GraphTest
- @coversDefaultClass \Drupal\Component\Graph\Graph @group Graph
Namespace
Drupal\Tests\Component\GraphCode
protected function normalizeGraph($graph) {
$normalized_graph = array();
foreach ($graph as $vertex => $edges) {
// Create vertex even if it hasn't any edges.
$normalized_graph[$vertex] = array();
foreach ($edges as $edge) {
$normalized_graph[$vertex]['edges'][$edge] = TRUE;
}
}
return $normalized_graph;
}