コード例 #1
0
EdgeSetIF * MSTSolverIF::getMST(EdgeSetIF* visibleSet)
		throw (GraphExceptions::DisconnectedGraphException) {
	ConnectivityList connectivityList = GraphUtils::shrinkConnectivityToSet(
			graph, visibleSet);
	EdgeSetIF* minimumSpanningTree = getMST();
	graph->restoreConnectivityAllEdges(connectivityList);
	return minimumSpanningTree;
}
コード例 #2
0
EdgeSetIF * MSTSolverIF::getMST(VertexIF * const initialVertex,
		EdgeSetIF* visibleSet)
				throw (GraphExceptions::DisconnectedGraphException) {
	VisibilityList visibilityList = GraphUtils::shrinkVisibilityToSet(graph,
			visibleSet);
	EdgeSetIF* minimumSpanningTree = getMST(initialVertex);
	graph->restoreVisibilityAllEdges(visibilityList);
	return minimumSpanningTree;
}
コード例 #3
0
EdgeSetIF * MSTSolverIF::getMST()
		throw (GraphExceptions::DisconnectedGraphException) {
	if (!graph->hasAnyVertex(Visibility::VISIBLE)) {
		WARN(logger, LogBundleKey::MSTS_IF_EMPTY_INPUT_GRAPH);
		return new EdgeSetImpl { };
	} else {
		return getMST(graph->nextVertex(Visibility::VISIBLE));
	}
}
コード例 #4
0
std::vector<std::string> Graph::getPairs(int root) {
	std::vector<Edge> temp = getMST(root);
	std::vector<std::string> result;
	for (std::vector<Edge>::iterator it = temp.begin(); it != temp.end(); it++) {
		std::ostringstream s1;
		s1 << it->getDestination();
		std::ostringstream s2;
		s2 << it->getSource();
		result.push_back(s1.str() + " " + s2.str());
	}
	return result;
}
コード例 #5
0
EdgeSetIF * MSTSolverIF::getMST(VertexIF * const initialVertex)
		throw (GraphExceptions::DisconnectedGraphException) {
	if (initialVertex == nullptr) {
		return getMST();
	}
	if (GraphUtils::isGraphConnected(graph) == false) {
		ERROR(logger, LogBundleKey::MSTS_IF_GRAPH_NOT_CONNECTED);
		throw GraphExceptions::DisconnectedGraphException();
	} else {
		INFO(logger, LogBundleKey::MSTS_IF_CONSTRUCT_FROM_SOURCE,
				graph->getNumberOfVertices(Visibility::VISIBLE),
				graph->getNumberOfEdges(Visibility::VISIBLE),
				initialVertex->getVertexIdx());
		return resolve(initialVertex);
	}
}