Esempio n. 1
0
void SetStandard(Graph graph)
{   int elabel, adj_node, i, j;
    int u, v, currentedge;
    Edge edge;

    currentedge = U+2;
    for (i=1; i<=U; ++i) {
	edge = FirstEdge(graph,i);
	for (j = 1; j <= Degree(graph,i); ++j) {
	    adj_node = EndPoint(edge);
	    if (i < adj_node) {
		elabel = ELabel(edge)*2;
		WEIGHT[currentedge-1] = WEIGHT[currentedge] = 2*elabel;
		END[currentedge-1] = i;
		END[currentedge] = adj_node;
		if (A[i] == 0)
		    A[i] = currentedge;
		else {
		    u = i;
		    v = A[i];
		    while (v != 0) {
			if (END[v] > adj_node)
			    break;
			u = v;
			v = A[v];
			}
		    A[u] = currentedge;
		    A[currentedge] = v;
		    }
		u = adj_node;
		v = A[u];
		while (v != 0) {
		    u = v;
		    v = A[v];
		    }
		A[u] = currentedge - 1;
		currentedge += 2;
		}
	    edge = NextEdge(edge);
	    }
	}
}
Esempio n. 2
0
void Complex2D::calculate_num_of_edges() const 
{
  num_of_edges_cache= 0;
  for(EdgeIterator e(FirstEdge()); ! e.IsDone(); ++e)
    ++num_of_edges_cache;
}