Files
revng-revng/lib/Yield/Support/SugiyamaStyleGraphLayout/LayoutConversion.cpp
T
Ivan Krysak 98b098cbce Import graph layout finalization from caliban
(the following is the original commit message)

Since from this point on, no breaking changes will be done to the graph
It's possible to finalize the layout. Meaning that from this point
onwards the logical positions of the nodes remain unchanged.

Having this guarantee we can proceed to calculating their real
positions, starting from the horizontal coordinates.
2022-06-15 16:04:44 +03:00

17 lines
457 B
C++

/// \file LayoutConversion.cpp
/// \brief
//
// This file is distributed under the MIT License. See LICENSE.md for details.
//
#include "Layout.h"
LayoutContainer convertToLayout(const LayerContainer &Layers) {
LayoutContainer Result;
for (size_t Index = 0; Index < Layers.size(); ++Index)
for (size_t NodeIndex = 0; NodeIndex < Layers[Index].size(); ++NodeIndex)
Result[Layers[Index][NodeIndex]] = { Index, NodeIndex };
return Result;
}