21 #ifndef _TLPGRAPHTOOLS_H 22 #define _TLPGRAPHTOOLS_H 29 #include <unordered_map> 30 #include <tulip/tulipconf.h> 31 #include <tulip/Node.h> 32 #include <tulip/Edge.h> 33 #include <tulip/MutableContainer.h> 34 #include <tulip/StaticProperty.h> 35 #include <tulip/Iterator.h> 38 class BooleanProperty;
41 class IntegerProperty;
42 class NumericProperty;
46 enum EDGE_TYPE { UNDIRECTED = 0, INV_DIRECTED = 1, DIRECTED = 2 };
47 #define IN_EDGE INV_DIRECTED 48 #define OUT_EDGE DIRECTED 49 #define INOUT_EDGE UNDIRECTED 52 typedef Iterator<edge> *(*EdgesIteratorFn)(
const tlp::Graph *,
const tlp::node);
58 TLP_SCOPE NodesIteratorFn getNodesIterator(EDGE_TYPE direction);
64 TLP_SCOPE EdgesIteratorFn getEdgesIterator(EDGE_TYPE direction);
74 TLP_SCOPE std::vector<std::vector<node>>
75 computeCanonicalOrdering(PlanarConMap *, std::vector<edge> *dummyEdges =
nullptr,
76 PluginProgress *pluginProgress =
nullptr);
81 TLP_SCOPE std::vector<node> computeGraphCenters(Graph *graph);
87 TLP_SCOPE node graphCenterHeuristic(Graph *graph, PluginProgress *pluginProgress =
nullptr);
92 TLP_SCOPE node makeSimpleSource(Graph *graph);
94 TLP_SCOPE
void makeProperDag(Graph *graph, std::list<node> &addedNodes,
95 std::unordered_map<edge, edge> &replacedEdges,
96 IntegerProperty *edgeLength =
nullptr);
104 TLP_SCOPE
void selectSpanningForest(Graph *graph, BooleanProperty *selectionProperty,
105 PluginProgress *pluginProgress =
nullptr);
113 TLP_SCOPE
void selectSpanningTree(Graph *graph, BooleanProperty *selection,
114 PluginProgress *pluginProgress =
nullptr);
122 TLP_SCOPE
void selectMinimumSpanningTree(Graph *graph, BooleanProperty *selectionProperty,
123 NumericProperty *weight =
nullptr,
124 PluginProgress *pluginProgress =
nullptr);
135 TLP_SCOPE
void bfs(
const Graph *graph, node root, std::vector<node> &nodes);
143 TLP_SCOPE
void bfs(
const Graph *graph, std::vector<node> &nodes);
156 TLP_SCOPE
void dfs(
const Graph *graph, node root, std::vector<node> &nodes);
164 TLP_SCOPE
void dfs(
const Graph *graph, std::vector<node> &nodes);
170 TLP_SCOPE
void buildNodesUniformQuantification(
const Graph *graph,
const NumericProperty *prop,
171 unsigned int k, std::map<double, int> &mapping);
177 TLP_SCOPE
void buildEdgesUniformQuantification(
const Graph *graph,
const NumericProperty *prop,
178 unsigned int k, std::map<double, int> &mapping);
187 TLP_SCOPE
unsigned makeSelectionGraph(
const Graph *graph, BooleanProperty *selection,
188 bool *test =
nullptr);
195 enum ShortestPathType {
200 AllDirectedPaths = 4,
217 TLP_SCOPE
bool selectShortestPaths(
const Graph *
const graph, node src, node tgt,
218 ShortestPathType pathType,
const DoubleProperty *
const weights,
219 BooleanProperty *selection);
229 TLP_SCOPE
void markReachableNodes(
const Graph *graph,
const node startNode,
230 std::unordered_map<node, bool> &reachables,
231 unsigned int maxDistance, EDGE_TYPE direction = UNDIRECTED);
233 TLP_SCOPE
void computeDijkstra(
const Graph *
const graph, node src,
234 const EdgeStaticProperty<double> &weights,
235 NodeStaticProperty<double> &nodeDistance, EDGE_TYPE direction,
236 std::unordered_map<node, std::list<node>> &ancestors,
237 std::stack<node> *queueNodes =
nullptr,
238 MutableContainer<int> *numberOfPaths =
nullptr);
The node struct represents a node in a Graph object.