mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-10 20:04:46 +00:00
0705dae8a3
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7703 a592a061-630c-0410-9148-cb99ea01b6c8
64 lines
1.0 KiB
C++
64 lines
1.0 KiB
C++
// -*- C++ -*-
|
|
/**
|
|
* \file graph.h
|
|
* This file is part of LyX, the document processor.
|
|
* Licence details can be found in the file COPYING.
|
|
*
|
|
* \author Dekel Tsur
|
|
*
|
|
* Full author contact details are available in file CREDITS.
|
|
*/
|
|
|
|
#ifndef GRAPH_H
|
|
#define GRAPH_H
|
|
|
|
#include <queue>
|
|
#include <vector>
|
|
|
|
|
|
class Graph {
|
|
public:
|
|
Graph() : numedges_(0) {};
|
|
///
|
|
typedef std::vector<int> EdgePath;
|
|
///
|
|
std::vector<int> const
|
|
getReachableTo(int, bool clear_visited);
|
|
///
|
|
std::vector<int> const
|
|
getReachable(int, bool only_viewable,
|
|
bool clear_visited);
|
|
///
|
|
bool isReachable(int, int);
|
|
///
|
|
EdgePath const getPath(int, int);
|
|
///
|
|
void addEdge(int s, int t);
|
|
///
|
|
void init(int size);
|
|
|
|
private:
|
|
///
|
|
int bfs_init(int, bool clear_visited = true);
|
|
|
|
///
|
|
struct Vertex {
|
|
std::vector<int> in_vertices;
|
|
std::vector<int> out_vertices;
|
|
std::vector<int> out_edges;
|
|
};
|
|
///
|
|
static
|
|
std::vector<Vertex> vertices_;
|
|
///
|
|
std::vector<bool> visited_;
|
|
///
|
|
std::queue<int> Q_;
|
|
|
|
int numedges_;
|
|
|
|
};
|
|
|
|
|
|
#endif //GRAPH_H
|