This example shows a simple graph import plug-in.It details the different functions and possibilities of a Graph import plug-in.
#include <string>
#include <tulip/TulipPluginHeaders.h>
class CliqueImport : public tlp::ImportModule {
public:
PLUGININFORMATION(
"Clique",
"Tulip Team",
"05/10/2012",
"Clique Import Plugin",
"1.0",
"Graph")
~CliqueImport();
};
const char *nodeCountDescription = "How many nodes the clique will contain";
addInParameter<unsigned int>("nodeCount", nodeCountDescription, "5");
addDependency("Circular", "1.1");
}
CliqueImport::~CliqueImport() {}
unsigned int nodeCount = 5;
dataSet->get("nodeCount", nodeCount);
for (unsigned int i = 0; i < nodeCount; ++i) {
}
for (auto current : graph->nodes()) {
for (auto other : graph->nodes()) {
if (current != other) {
graph->addEdge(current, other);
}
}
}
string message;
graph->applyPropertyAlgorithm("Circular", layout, message);
return true;
}