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>
46enum 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
58TLP_SCOPE NodesIteratorFn getNodesIterator(EDGE_TYPE direction);
64TLP_SCOPE EdgesIteratorFn getEdgesIterator(EDGE_TYPE direction);
74TLP_SCOPE std::vector<std::vector<node>>
75computeCanonicalOrdering(PlanarConMap *, std::vector<edge> *dummyEdges =
nullptr,
76 PluginProgress *pluginProgress =
nullptr);
81TLP_SCOPE std::vector<node> computeGraphCenters(Graph *graph);
87TLP_SCOPE node graphCenterHeuristic(Graph *graph, PluginProgress *pluginProgress =
nullptr);
92TLP_SCOPE node makeSimpleSource(Graph *graph);
94TLP_SCOPE
void makeProperDag(Graph *graph, std::list<node> &addedNodes,
95 std::unordered_map<edge, edge> &replacedEdges,
96 IntegerProperty *edgeLength =
nullptr);
104TLP_SCOPE
void selectSpanningForest(Graph *graph, BooleanProperty *selectionProperty,
105 PluginProgress *pluginProgress =
nullptr);
113TLP_SCOPE
void selectSpanningTree(Graph *graph, BooleanProperty *selection,
114 PluginProgress *pluginProgress =
nullptr);
122TLP_SCOPE
void selectMinimumSpanningTree(Graph *graph, BooleanProperty *selectionProperty,
123 NumericProperty *weight =
nullptr,
124 PluginProgress *pluginProgress =
nullptr);
135TLP_SCOPE
void bfs(
const Graph *graph, node root, std::vector<node> &nodes);
143TLP_SCOPE
void bfs(
const Graph *graph, std::vector<node> &nodes);
156TLP_SCOPE
void dfs(
const Graph *graph, node root, std::vector<node> &nodes);
164TLP_SCOPE
void dfs(
const Graph *graph, std::vector<node> &nodes);
170TLP_SCOPE
void buildNodesUniformQuantification(
const Graph *graph,
const NumericProperty *prop,
171 unsigned int k, std::map<double, int> &mapping);
177TLP_SCOPE
void buildEdgesUniformQuantification(
const Graph *graph,
const NumericProperty *prop,
178 unsigned int k, std::map<double, int> &mapping);
187TLP_SCOPE
unsigned makeSelectionGraph(
const Graph *graph, BooleanProperty *selection,
188 bool *test =
nullptr);
195enum ShortestPathType {
200 AllDirectedPaths = 4,
217TLP_SCOPE
bool selectShortestPaths(
const Graph *
const graph, node src, node tgt,
218 ShortestPathType pathType,
const DoubleProperty *
const weights,
219 BooleanProperty *selection);
229TLP_SCOPE
void markReachableNodes(
const Graph *graph,
const node startNode,
230 std::unordered_map<node, bool> &reachables,
231 unsigned int maxDistance, EDGE_TYPE direction = UNDIRECTED);
233TLP_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.