Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(util): Add GraphViz helper types #3635

Merged
merged 2 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 110 additions & 0 deletions Core/include/Acts/Utilities/GraphViz.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
// This file is part of the Acts project.
//
// Copyright (C) 2024 CERN for the benefit of the Acts project
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

#pragma once

#include <ostream>
#include <vector>

namespace Acts::GraphViz {

enum class Shape {
Box,
Polygon,
Ellipse,
Oval,
Circle,
Point,
Egg,
Triangle,
Plaintext,
Plain,
Diamond,
Trapezium,
Parallelogram,
House,
Pentagon,
Hexagon,
Septagon,
Octagon,
DoubleCircle,
DoubleOctagon,
TripleOctagon,
InvTriangle,
InvTrapezium,
InvHouse,
Mdiamond,
Msquare,
Mcircle,
Rect,
Rectangle,
Square,
Star,
None,
Underline,
Cylinder,
Note,
Tab,
Folder,
Box3d,
Component,
Promoter,
Cds,
Terminator,
Utr,
PrimerSite,
RestrictionSite,
FivePOverhang,
ThreePOverhang,
NOverhang,
Assembly,
Signature,
Insulator,
Ribosite,
RNAStab,
ProteaseSite,
ProteinStab,
RPromoter,
RArrow,
LArrow,
LPromoter
};

std::ostream& operator<<(std::ostream& os, const Shape& shape);

enum class Style {
Filled,
Invisible,
Diagonals,
Rounded,
Dashed,
Dotted,
Solid,
Bold
};

std::ostream& operator<<(std::ostream& os, const Style& style);

struct Node {
std::string id;
std::string label;
Shape shape = Shape::Ellipse;
std::vector<Style> style = {Style::Solid};
};

std::ostream& operator<<(std::ostream& os, const Node& node);

struct Edge {
Node from;
Node to;
Style style = Style::Solid;
};

std::ostream& operator<<(std::ostream& os, const Edge& node);

} // namespace Acts::GraphViz
1 change: 1 addition & 0 deletions Core/src/Utilities/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ target_sources(
TrackHelpers.cpp
BinningType.cpp
Intersection.cpp
GraphViz.cpp
)
Loading
Loading