mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-15 09:43:31 +00:00
c9f9ba315c
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9502 a592a061-630c-0410-9148-cb99ea01b6c8
65 lines
1.0 KiB
C++
65 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);
|
|
|
|
///
|
|
class Vertex {
|
|
public:
|
|
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
|