Files
revng-revng/lib/Yield/Support/SugiyamaStyleGraphLayout.cpp
Ivan Krysak c45f4d5e73 Import graph preparation from caliban
(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.
2022-06-15 16:04:44 +03:00

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");
}
}