Martin Šach 21116995d7 Refactor CMake and improve #includes.
* 1. Remove all global include_directories.
* 2. Move 3d party dependencies from src to budled deps if possible.
* Unify and enforce one way of including headers:
    e.g. #include "libslic3r/GCode.hpp" vs #include "GCode.hpp"
    (always use the "libslic3r/GCode.hpp" option).
* Make all dependencies (also header only) a cmake target.
2024-07-08 15:36:46 +02:00

50 lines
1.3 KiB
C++

#ifndef IGL_DFS_H
#define IGL_DFS_H
#include "igl_inline.h"
#include <Eigen/Core>
#include <vector>
namespace igl
{
// Traverse a **directed** graph represented by an adjacency list using
// depth first search
//
// Inputs:
// A #V list of adjacency lists
// s starting node (index into A)
// Outputs:
// D #V list of indices into rows of A in the order in which graph nodes
// are discovered.
// P #V list of indices into rows of A of predecessor in resulting
// spanning tree {-1 indicates root/not discovered), order corresponds to
// V **not** D.
// C #V list of indices into rows of A in order that nodes are "closed"
// (all descendants have been discovered)
template <
typename AType,
typename DerivedD,
typename DerivedP,
typename DerivedC>
IGL_INLINE void dfs(
const std::vector<std::vector<AType> > & A,
const size_t s,
Eigen::PlainObjectBase<DerivedD> & D,
Eigen::PlainObjectBase<DerivedP> & P,
Eigen::PlainObjectBase<DerivedC> & C);
template <
typename AType,
typename DType,
typename PType,
typename CType>
IGL_INLINE void dfs(
const std::vector<std::vector<AType> > & A,
const size_t s,
std::vector<DType> & D,
std::vector<PType> & P,
std::vector<CType> & C);
}
#ifndef IGL_STATIC_LIBRARY
# include "dfs.cpp"
#endif
#endif