src/graph.cpp
// remove cycles in a graph and create a DAG, modify the blockVtx passed in to remove conflicts, the conflicts should be added back to the end of this vtx after toposort
remove cycles in a graph and create a DAG, modify the blockVtx passed in to remove conflicts, the conflicts should be added back to the end of this vtx after toposort
remove cycles in a graph and create a DAG modify the blockVtx passed in to remove conflicts the conflicts should be added back to the end of this vtx after toposort
void GraphRemoveCycles(const std::vector<CTransactionRef>& blockVtx, std::vector<int> &conflictedIndexes, Graph& graph, const std::vector<vertex_descriptor> &vertices, IndexMap &mapTxIndex) {
	sorted_vector<int> clearedVertices;
	cycle_visitor<sorted_vector<int> > visitor(clearedVertices);
	hawick_circuits(graph, visitor);
	for (auto& nVertex : clearedVertices) {
		IndexMap::const_iterator it = mapTxIndex.find(nVertex);
		if (it == mapTxIndex.end())
			continue;
		const int nVertexIndex = (*it).first;
		if (nVertexIndex >= (int)vertices.size())
			continue;
		boost::clear_out_edges(vertices[nVertexIndex], graph);
		const std::vector<int> &vecTx = (*it).second;
		for (auto& nIndex : vecTx) {
			if (nIndex >= (int)blockVtx.size())
				continue;
			conflictedIndexes.push_back(nIndex);
		}
		mapTxIndex.erase(it);
	}
	std::sort(conflictedIndexes.begin(), conflictedIndexes.end());
}
void GraphRemoveCycles ( const std :: vector < CTransactionRef > & blockVtx , std :: vector < int > & conflictedIndexes , Graph & graph , const std :: vector < vertex_descriptor > & vertices , IndexMap & mapTxIndex ) { sorted_vector < int > clearedVertices ; cycle_visitor < sorted_vector < int > > visitor ( clearedVertices ) ; hawick_circuits ( graph , visitor ) ; for ( auto & nVertex : clearedVertices ) { IndexMap :: const_iterator it = mapTxIndex . find ( nVertex ) ; if ( it == mapTxIndex . end ( ) ) continue ; const int nVertexIndex = ( * it ) . first ; if ( nVertexIndex >= ( int ) vertices . size ( ) ) continue ; boost :: clear_out_edges ( vertices [ nVertexIndex ] , graph ) ; const std :: vector < int > & vecTx = ( * it ) . second ; for ( auto & nIndex : vecTx ) { if ( nIndex >= ( int ) blockVtx . size ( ) ) continue ; conflictedIndexes . push_back ( nIndex ) ; } mapTxIndex . erase ( it ) ; } std :: sort ( conflictedIndexes . begin ( ) , conflictedIndexes . end ( ) ) ; }
remove cycles in a graph and create a DAG, modify the blockVtx passed in to remove conflicts, the conflicts should be added back to the end of this vtx after toposort
remove cycles in a graph and create a DAG modify the blockVtx passed in to remove conflicts the conflicts should be added back to the end of this vtx after toposort
// remove from graph // mapTxIndex knows of the mapping between vertices and tx vout positions // block gives us the transactions in order by time so we want to ensure we preserve it