mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
4a2898596f
(the following is the original commit message) Preparation includes: - ensuring there are no loops. - ensuring there are no edges spanning more than a single layer. - ensuring there are no backwards facing edges that were not split into a bunch of parts to simplify laying them out. - ensuring there are no self loops (they are treated similarly to backwards facing edges, which they theoretically are). Subproducts include: - `Classifier` allowing to cheaply determine whether a given node is adjacent to an artificial edge. - `Ranks` container allowing to easily determine the layer each of the nodes belongs to.
30 lines
1.0 KiB
C++
30 lines
1.0 KiB
C++
/// \file SugiyamaStyleGraphLayout.cpp
|
|
/// \brief
|
|
|
|
//
|
|
// This file is distributed under the MIT License. See LICENSE.md for details.
|
|
//
|
|
|
|
#include "revng/Yield/Support/SugiyamaStyleGraphLayout.h"
|
|
|
|
#include "SugiyamaStyleGraphLayout/Layout.h"
|
|
|
|
bool yield::sugiyama::layout(Graph &Graph, const Configuration &Configuration) {
|
|
using RS = yield::sugiyama::RankingStrategy;
|
|
|
|
switch (Configuration.Ranking) {
|
|
case RS::BreadthFirstSearch:
|
|
return calculateSugiyamaLayout<RS::BreadthFirstSearch>(Graph,
|
|
Configuration);
|
|
case RS::DepthFirstSearch:
|
|
return calculateSugiyamaLayout<RS::DepthFirstSearch>(Graph, Configuration);
|
|
case RS::Topological:
|
|
return calculateSugiyamaLayout<RS::Topological>(Graph, Configuration);
|
|
case RS::DisjointDepthFirstSearch:
|
|
return calculateSugiyamaLayout<RS::DisjointDepthFirstSearch>(Graph,
|
|
Configuration);
|
|
default:
|
|
revng_abort("Unknown ranking strategy");
|
|
}
|
|
}
|