Esempio n. 1
0
	void initMetisGraph(int nc)
	{

		// Get the number of vertex

		Mg.nvtxs = new idx_t[1];
		Mg.nvtxs[0] = g.getNVertex();

		// Set the number of constrains

		Mg.ncon = new idx_t[1];
		Mg.ncon[0] = 1;

		// Set to null the weight of the vertex

		Mg.vwgt = NULL;

		// Put the total communication size to NULL

		Mg.vsize = NULL;

		// Set to null the weight of the edge

		Mg.adjwgt = NULL;

		// construct the adjacency list
		if (useWeights)
			constructAdjListWithWeights(g);
		else
			constructAdjList(g);

		// Set the total number of partitions

		Mg.nparts = new idx_t[1];
		Mg.nparts[0] = nc;

		// Set to null the desired weight for each partition (one for each constrain)

		Mg.tpwgts = NULL;

		//! Set to null the partition load imbalance tolerance

		Mg.ubvec = NULL;

		//! Set tp null additional option for the graph partitioning

		Mg.options = NULL;

		//! set the objective value
		Mg.objval = new idx_t[1];

		//! Is an output vector containing the partition for each vertex
		Mg.part = new idx_t[g.getNVertex()];

		for (size_t i = 0; i < g.getNVertex(); i++)
			Mg.part[i] = 0;
	}
Esempio n. 2
0
void FordFulkerson::init()
{
    nodeStack = new stack<Node*>();
    constructAdjList();
    for( int i=0; i<headCount; i++)
    {
        currentState[i] = flowPair(i,-1);
    }
    Qs = 0;
    augmentingPath = 0;
    current = -1;
    source = 0;
    target = 6;
    nodeStack->push(nodes[0].next);
    currentState[0] = flowPair(0,999999);
}